summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Directed/shift/int64.cs
diff options
context:
space:
mode:
authorPat Gavlin <pagavlin@microsoft.com>2015-05-18 09:53:47 -0700
committerPat Gavlin <pagavlin@microsoft.com>2015-05-19 13:55:42 -0700
commit31e98f2aa7308d2beebeb38af715fb2244cdba46 (patch)
tree58ce245d40d61c699d5c645c31cf509fcadd9f79 /tests/src/JIT/Directed/shift/int64.cs
parent10990901f7bcf370415ff3cb3f042a79c64b1c22 (diff)
downloadcoreclr-31e98f2aa7308d2beebeb38af715fb2244cdba46.tar.gz
coreclr-31e98f2aa7308d2beebeb38af715fb2244cdba46.tar.bz2
coreclr-31e98f2aa7308d2beebeb38af715fb2244cdba46.zip
Import JIT tests.
This brings over most of the tests from `JIT/Directed` that can target CoreCLR.
Diffstat (limited to 'tests/src/JIT/Directed/shift/int64.cs')
-rw-r--r--tests/src/JIT/Directed/shift/int64.cs155
1 files changed, 155 insertions, 0 deletions
diff --git a/tests/src/JIT/Directed/shift/int64.cs b/tests/src/JIT/Directed/shift/int64.cs
new file mode 100644
index 0000000000..e61b0d6e7d
--- /dev/null
+++ b/tests/src/JIT/Directed/shift/int64.cs
@@ -0,0 +1,155 @@
+// Copyright (c) Microsoft. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+//
+
+using System;
+
+namespace ShiftTest
+{
+ public class CL
+ {
+ public long clm_data = 0x7FFFFFFFFFFFFFFF;
+ }
+ public struct VT
+ {
+ public long vtm_data;
+ }
+ public class longTest
+ {
+ private static long s_data = 0x7FFFFFFFFFFFFFFF;
+ public static long f1(long arg_data)
+ {
+ arg_data >>= 8;
+ return arg_data;
+ }
+ public static long f2(long arg_data)
+ {
+ arg_data <<= 8;
+ return arg_data;
+ }
+ public static int Main()
+ {
+ long loc_data = 0x7FFFFFFFFFFFFFFF;
+
+ long[] arr_data = new long[1];
+
+ CL cl = new CL();
+ VT vt;
+
+ s_data = 0x7FFFFFFFFFFFFFFF;
+ loc_data = 0x7FFFFFFFFFFFFFFF;
+ arr_data[0] = 0x7FFFFFFFFFFFFFFF;
+ cl.clm_data = 0x7FFFFFFFFFFFFFFF;
+ vt.vtm_data = 0x7FFFFFFFFFFFFFFF;
+
+ // Test >>
+
+ Console.WriteLine("The expected result of (0x7FFFFFFFFFFFFFFF>>8) is: {0}", (0x7FFFFFFFFFFFFFFF >> 8));
+ Console.WriteLine();
+
+ Console.WriteLine("The actual result for funciton argument is: {0}", f1(0x7FFFFFFFFFFFFFFF));
+ loc_data >>= 8;
+ Console.WriteLine("The actual result for local variable is: {0}", loc_data);
+ s_data >>= 8;
+ Console.WriteLine("The actual result for static field is: {0}", s_data);
+ arr_data[0] >>= 8;
+ Console.WriteLine("The actual result for array element is: {0}", arr_data[0]);
+ cl.clm_data >>= 8;
+ Console.WriteLine("The actual result for class member is: {0}", cl.clm_data);
+ vt.vtm_data >>= 8;
+ Console.WriteLine("The actual result for valuestruct member is: {0}", vt.vtm_data);
+
+ Console.WriteLine();
+
+ if (loc_data != (0x7FFFFFFFFFFFFFFF >> 8))
+ {
+ Console.WriteLine("FAILED for local variable");
+ return -1;
+ }
+ if (f1(0x7FFFFFFFFFFFFFFF) != (0x7FFFFFFFFFFFFFFF >> 8))
+ {
+ Console.WriteLine("FAILED for function argument");
+ return -1;
+ }
+ if (s_data != (0x7FFFFFFFFFFFFFFF >> 8))
+ {
+ Console.WriteLine("FAILED for static field");
+ return -1;
+ }
+ if (arr_data[0] != (0x7FFFFFFFFFFFFFFF >> 8))
+ {
+ Console.WriteLine("FAILED for array element");
+ return -1;
+ }
+ if (cl.clm_data != (0x7FFFFFFFFFFFFFFF >> 8))
+ {
+ Console.WriteLine("FAILED for class member");
+ return -1;
+ }
+ if (vt.vtm_data != (0x7FFFFFFFFFFFFFFF >> 8))
+ {
+ Console.WriteLine("FAILED for valuestruct member");
+ return -1;
+ }
+
+ // Test <<
+
+ s_data = 0x1;
+ loc_data = 0x1;
+ arr_data[0] = 0x1;
+ cl.clm_data = 0x1;
+ vt.vtm_data = 0x1;
+
+ Console.WriteLine("The expected result of (0x1<<8) is: {0}", ((long)0x1 << 8));
+ Console.WriteLine();
+
+ Console.WriteLine("The actual result for funciton argument is: {0}", f2(0x1));
+ loc_data <<= 8;
+ Console.WriteLine("The actual result for local variable is: {0}", loc_data);
+ s_data <<= 8;
+ Console.WriteLine("The actual result for static field is: {0}", s_data);
+ arr_data[0] <<= 8;
+ Console.WriteLine("The actual result for array element is: {0}", arr_data[0]);
+ cl.clm_data <<= 8;
+ Console.WriteLine("The actual result for class member is: {0}", cl.clm_data);
+ vt.vtm_data <<= 8;
+ Console.WriteLine("The actual result for valuestruct member is: {0}", vt.vtm_data);
+
+ Console.WriteLine();
+
+ if (loc_data != (0x1 << 8))
+ {
+ Console.WriteLine("FAILED for local variable");
+ return -1;
+ }
+ if (f2(0x1) != (0x1 << 8))
+ {
+ Console.WriteLine("FAILED for function argument");
+ return -1;
+ }
+ if (s_data != (0x1 << 8))
+ {
+ Console.WriteLine("FAILED for static field");
+ return -1;
+ }
+ if (arr_data[0] != (0x1 << 8))
+ {
+ Console.WriteLine("FAILED for array element");
+ return -1;
+ }
+ if (cl.clm_data != (0x1 << 8))
+ {
+ Console.WriteLine("FAILED for class member");
+ return -1;
+ }
+ if (vt.vtm_data != (0x1 << 8))
+ {
+ Console.WriteLine("FAILED for valuestruct member");
+ return -1;
+ }
+
+ Console.WriteLine("PASSED");
+ return 100;
+ }
+ }
+}