diff options
Diffstat (limited to 'tests/src/JIT/CodeGenBringUpTests/Rotate.cs')
-rw-r--r-- | tests/src/JIT/CodeGenBringUpTests/Rotate.cs | 96 |
1 files changed, 94 insertions, 2 deletions
diff --git a/tests/src/JIT/CodeGenBringUpTests/Rotate.cs b/tests/src/JIT/CodeGenBringUpTests/Rotate.cs index 74a936ef13..9c5d9599a6 100644 --- a/tests/src/JIT/CodeGenBringUpTests/Rotate.cs +++ b/tests/src/JIT/CodeGenBringUpTests/Rotate.cs @@ -102,12 +102,38 @@ public class Test [MethodImpl(MethodImplOptions.NoInlining)] static ulong rol64const() { - ulong value = flag() ? (ulong)0x123456789abcdef : (ulong)0x123456789abcdef; + ulong value = flag() ? (ulong)0x123456789abcdef : (ulong)0xabcdef123456789; int amount = 16; return (value >> (64 - amount)) | (value << amount); } [MethodImpl(MethodImplOptions.NoInlining)] + static ulong rol64_16(ulong value) + { + return (value >> (64 - 16)) | (value << 16); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static ulong rol64_32(ulong value) + { + return (value >> (64 - 32)) | (value << 32); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static ulong rol64_32_inplace(ulong value, ulong added) + { + ulong x = value + added; + x = (x >> (64 - 32)) | (x << 32); + return x; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static ulong rol64_33(ulong value) + { + return (value >> (64 - 33)) | (value << 33); + } + + [MethodImpl(MethodImplOptions.NoInlining)] ulong rol64field(int amount) { return (field << amount) | (field >> (64 - amount)); @@ -128,12 +154,38 @@ public class Test [MethodImpl(MethodImplOptions.NoInlining)] static ulong ror64const() { - ulong value = flag() ? (ulong)0x123456789abcdef : (ulong)0x123456789abcdef; + ulong value = flag() ? (ulong)0x123456789abcdef : (ulong)0xabcdef123456789; int amount = flag() ? 5 : 5; return (value << (64 - amount)) | (value >> amount); } [MethodImpl(MethodImplOptions.NoInlining)] + static ulong ror64_5(ulong value) + { + return (value << (64 - 5)) | (value >> 5); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static ulong ror64_32(ulong value) + { + return (value << (64 - 32)) | (value >> 32); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static ulong ror64_33(ulong value) + { + return (value << (64 - 33)) | (value >> 33); + } + + [MethodImpl(MethodImplOptions.NoInlining)] + static ulong ror64_32_inplace(ulong value, ulong added) + { + ulong x = value + added; + x = (x << (64 - 32)) | (x >> 32); + return x; + } + + [MethodImpl(MethodImplOptions.NoInlining)] static ulong ror64sfield(int amount) { return (s_field << (64 - amount)) | (s_field >> amount); @@ -244,6 +296,26 @@ public class Test return Fail; } + if (rol64_16(0x123456789abcdef) != 0x456789abcdef0123) + { + return Fail; + } + + if (rol64_32(0x123456789abcdef) != rol64(0x123456789abcdef, 32)) + { + return Fail; + } + + if (rol64_33(0x123456789abcdef) != rol64(0x123456789abcdef, 33)) + { + return Fail; + } + + if (rol64_32_inplace(0x123456789abcdef, 0) != rol64(0x123456789abcdef, 32)) + { + return Fail; + } + if (ror64(0x123456789abcdef, 0) != 0x123456789abcdef) { return Fail; @@ -259,6 +331,26 @@ public class Test return Fail; } + if (ror64_5(0x123456789abcdef) != 0x78091a2b3c4d5e6f) + { + return Fail; + } + + if (ror64_32(0x123456789abcdef) != ror64(0x123456789abcdef, 32)) + { + return Fail; + } + + if (ror64_33(0x123456789abcdef) != ror64(0x123456789abcdef, 33)) + { + return Fail; + } + + if (ror64_32_inplace(0x123456789abcdef, 0) != ror64(0x123456789abcdef, 32)) + { + return Fail; + } + if (rol32_call(0x12345678, 16) != 0x56781234) { return Fail; |