summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarol Eidt <carol.eidt@microsoft.com>2018-01-18 13:30:53 -0800
committerGitHub <noreply@github.com>2018-01-18 13:30:53 -0800
commit2620736ac1a2cfad18f8376abd7df469b182278b (patch)
tree9d86ee5b4f8ae70152b4012107d8479d946e8557 /tests
parent84efbc8e71fff8ccffdd637017036d2dc0f666df (diff)
parentf9a985db166ec393dc4683ecaaf083d370ae8c0a (diff)
downloadcoreclr-2620736ac1a2cfad18f8376abd7df469b182278b.tar.gz
coreclr-2620736ac1a2cfad18f8376abd7df469b182278b.tar.bz2
coreclr-2620736ac1a2cfad18f8376abd7df469b182278b.zip
Merge pull request #15901 from tannergooding/hwintrin-fixup
Resolving a few issues with the HWIntrinsic code
Diffstat (limited to 'tests')
-rw-r--r--tests/src/JIT/HardwareIntrinsics/X86/Sse/LoadAlignedVector128.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/src/JIT/HardwareIntrinsics/X86/Sse/LoadAlignedVector128.cs b/tests/src/JIT/HardwareIntrinsics/X86/Sse/LoadAlignedVector128.cs
index fdaf40ac19..eaf6909941 100644
--- a/tests/src/JIT/HardwareIntrinsics/X86/Sse/LoadAlignedVector128.cs
+++ b/tests/src/JIT/HardwareIntrinsics/X86/Sse/LoadAlignedVector128.cs
@@ -22,7 +22,8 @@ namespace IntelHardwareIntrinsicTest
if (Sse.IsSupported)
{
- float* inArray = stackalloc float[4];
+ byte* inBuffer = stackalloc byte[32];
+ float* inArray = Align(inBuffer, 16);
float* outArray = stackalloc float[4];
var vf = Sse.LoadAlignedVector128(inArray);
@@ -47,5 +48,15 @@ namespace IntelHardwareIntrinsicTest
return testResult;
}
+
+ static unsafe float* Align(byte* buffer, byte expectedAlignment)
+ {
+ // Compute how bad the misalignment is, which is at most (expectedAlignment - 1).
+ // Then subtract that from the expectedAlignment and add it to the original address
+ // to compute the aligned address.
+
+ var misalignment = expectedAlignment - ((ulong)(buffer) % expectedAlignment);
+ return (float*)(buffer + misalignment);
+ }
}
}