diff options
author | Tanner Gooding <tagoo@outlook.com> | 2018-03-16 11:33:37 -0700 |
---|---|---|
committer | Tanner Gooding <tagoo@outlook.com> | 2018-03-19 11:31:47 -0700 |
commit | c06fc2a5225f73411eb70ac9d0bbc00b9ad20308 (patch) | |
tree | a181905cd4638e4530aa829779041d70c2d9e24f /tests | |
parent | f849dcf6bc341f12fd0583f81d88760e08316ac9 (diff) | |
download | coreclr-c06fc2a5225f73411eb70ac9d0bbc00b9ad20308.tar.gz coreclr-c06fc2a5225f73411eb70ac9d0bbc00b9ad20308.tar.bz2 coreclr-c06fc2a5225f73411eb70ac9d0bbc00b9ad20308.zip |
Updating the x86 HWIntrinsic DataTable types to assert the alignment returned is correct
Diffstat (limited to 'tests')
10 files changed, 70 insertions, 10 deletions
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_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_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_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_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/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/ScalarUnOpTest_DataTable.cs b/tests/src/JIT/HardwareIntrinsics/X86/Shared/ScalarUnOpTest_DataTable.cs index 8c3b9a0699..55795e4bc5 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; @@ -53,7 +54,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_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_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_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; } } } |