diff options
author | Pat Gavlin <pagavlin@microsoft.com> | 2015-06-10 13:11:59 -0700 |
---|---|---|
committer | Pat Gavlin <pagavlin@microsoft.com> | 2015-06-10 21:31:41 -0700 |
commit | 937180e726dd08c84852a835bd711157769aed2b (patch) | |
tree | 8b9c350368cb9f2c57c2fea77d4cc90b51a80dd2 /tests/src/JIT/Methodical/ELEMENT_TYPE_IU | |
parent | c65178cbb205f8573c84791a31836fb3a7dd237e (diff) | |
download | coreclr-937180e726dd08c84852a835bd711157769aed2b.tar.gz coreclr-937180e726dd08c84852a835bd711157769aed2b.tar.bz2 coreclr-937180e726dd08c84852a835bd711157769aed2b.zip |
Import the first batch of IL tests.
This set of tests is comprised of IL tests that:
- only reference APIs in .Net Core's System.Runtime,
System.Runtime.Extensions, and System.Threading contracts
- compile to a single executable,
- and expect no command line arguments at runtime.
Diffstat (limited to 'tests/src/JIT/Methodical/ELEMENT_TYPE_IU')
33 files changed, 5863 insertions, 0 deletions
diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/ELEMENT_TYPE_IU.ilproj b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/ELEMENT_TYPE_IU.ilproj new file mode 100644 index 0000000000..c641f8da8a --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/ELEMENT_TYPE_IU.ilproj @@ -0,0 +1,19 @@ +<?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" /> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + </PropertyGroup> + <Target Name="Build"> + <ItemGroup> + <AllSourceFiles Include="$(MSBuildProjectDirectory)\*.il" /> + </ItemGroup> + <PropertyGroup> + <GenerateRunScript>false</GenerateRunScript> + </PropertyGroup> + <MSBuild Projects="il_template.proj" Properties="AssemblyName1=%(AllSourceFiles.FileName);AllowUnsafeBlocks=True;IntermediateOutputPath=$(IntermediateOutputPath)\%(AllSourceFiles.FileName)\" /> + </Target> +</Project>
\ No newline at end of file diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/app.config b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/app.config new file mode 100644 index 0000000000..8077c95440 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/conv_i8_i.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/conv_i8_i.il new file mode 100644 index 0000000000..aa0f4946b7 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/conv_i8_i.il @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + // Code size 48 (0x30) + .maxstack 5 +begin_1: + .try { + ldstr "test # 1" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000092 + conv.i + ldc.i4 0x00000092 + beq OK_1 + leave FAIL + OK_1: + leave begin_2 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_2: + .try { + ldstr "test # 2" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000e9 + conv.i + ldc.i4 0x000000e9 + beq OK_2 + leave FAIL + OK_2: + leave begin_3 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_3: + .try { + ldstr "test # 3" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000041 + conv.i + ldc.i4 0x00000041 + beq OK_3 + leave FAIL + OK_3: + leave begin_4 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_4: + .try { + ldstr "test # 4" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000014 + conv.i + ldc.i4 0x00000014 + beq OK_4 + leave FAIL + OK_4: + leave begin_5 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_5: + .try { + ldstr "test # 5" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000006b37 + conv.i + ldc.i4 0x00006b37 + beq OK_5 + leave FAIL + OK_5: + leave begin_6 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_6: + .try { + ldstr "test # 6" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000053a8 + conv.i + ldc.i4 0x000053a8 + beq OK_6 + leave FAIL + OK_6: + leave begin_7 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_7: + .try { + ldstr "test # 7" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000007561 + conv.i + ldc.i4 0x00007561 + beq OK_7 + leave FAIL + OK_7: + leave begin_8 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_8: + .try { + ldstr "test # 8" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000e30 + conv.i + ldc.i4 0x00000e30 + beq OK_8 + leave FAIL + OK_8: + leave begin_9 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_9: + .try { + ldstr "test # 9" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000007ba976 + conv.i + ldc.i4 0x007ba976 + beq OK_9 + leave FAIL + OK_9: + leave begin_10 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_10: + .try { + ldstr "test # 10" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000007540b0 + conv.i + ldc.i4 0x007540b0 + beq OK_10 + leave FAIL + OK_10: + leave begin_11 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_11: + .try { + ldstr "test # 11" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000089a7d6 + conv.i + ldc.i4 0x0089a7d6 + beq OK_11 + leave FAIL + OK_11: + leave begin_12 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_12: + .try { + ldstr "test # 12" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000c66850 + conv.i + ldc.i4 0x00c66850 + beq OK_12 + leave FAIL + OK_12: + leave begin_33 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_33: + + ldc.i4 0x64 + ldstr "passed" + br PRINT +FAIL: + ldc.i4.1 + ldstr "failed" +PRINT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/conv_i8_u.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/conv_i8_u.il new file mode 100644 index 0000000000..a99aad8ecb --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/conv_i8_u.il @@ -0,0 +1,521 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + // Code size 48 (0x30) + .maxstack 5 +begin_1: + .try { + ldstr "test # 1" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000000003b + conv.u + ldc.i4 0x0000003b + beq OK_1 + leave FAIL + OK_1: + leave begin_2 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_2: + .try { + ldstr "test # 2" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000015 + conv.u + ldc.i4 0x00000015 + beq OK_2 + leave FAIL + OK_2: + leave begin_3 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_3: + .try { + ldstr "test # 3" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000e7 + conv.u + ldc.i4 0x000000e7 + beq OK_3 + leave FAIL + OK_3: + leave begin_4 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_4: + .try { + ldstr "test # 4" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000bb + conv.u + ldc.i4 0x000000bb + beq OK_4 + leave FAIL + OK_4: + leave begin_5 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_5: + .try { + ldstr "test # 5" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000007615 + conv.u + ldc.i4 0x00007615 + beq OK_5 + leave FAIL + OK_5: + leave begin_6 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_6: + .try { + ldstr "test # 6" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000000d132 + conv.u + ldc.i4 0x0000d132 + beq OK_6 + leave FAIL + OK_6: + leave begin_7 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_7: + .try { + ldstr "test # 7" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000000642c + conv.u + ldc.i4 0x0000642c + beq OK_7 + leave FAIL + OK_7: + leave begin_8 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_8: + .try { + ldstr "test # 8" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000006c14 + conv.u + ldc.i4 0x00006c14 + beq OK_8 + leave FAIL + OK_8: + leave begin_9 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_9: + .try { + ldstr "test # 9" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000f118dc + conv.u + ldc.i4 0x00f118dc + beq OK_9 + leave FAIL + OK_9: + leave begin_10 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_10: + .try { + ldstr "test # 10" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000004c330 + conv.u + ldc.i4 0x0004c330 + beq OK_10 + leave FAIL + OK_10: + leave begin_11 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_11: + .try { + ldstr "test # 11" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000078c77f + conv.u + ldc.i4 0x0078c77f + beq OK_11 + leave FAIL + OK_11: + leave begin_12 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_12: + .try { + ldstr "test # 12" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000e020ba + conv.u + ldc.i4 0x00e020ba + beq OK_12 + leave FAIL + OK_12: + leave begin_13 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_13: + .try { + ldstr "test # 13" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000776f0a7a + conv.u + ldc.i4 0x776f0a7a + beq OK_13 + leave FAIL + OK_13: + leave begin_14 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_14: + .try { + ldstr "test # 14" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000057186a67 + conv.u + ldc.i4 0x57186a67 + beq OK_14 + leave FAIL + OK_14: + leave begin_15 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_15: + .try { + ldstr "test # 15 - bogus due to 64-bit" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) +// ldc.i8 0x00000000deee9c6f +// conv.u +// ldc.i4 0xdeee9c6f +// beq OK_15 +// leave FAIL + OK_15: +// leave begin_16 + leave begin_33 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_16: + .try { + ldstr "test # 16" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000001378a07 + conv.u + ldc.i4 0x01378a07 + beq OK_16 + leave FAIL + OK_16: + leave begin_17 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_17: + .try { + ldstr "test # 17" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000001d8f4a75e2 + conv.u + ldc.i4 0x8f4a75e2 + beq OK_17 + leave FAIL + OK_17: + leave begin_18 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_18: + .try { + ldstr "test # 18" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000064baba5d4e + conv.u + ldc.i4 0xbaba5d4e + beq OK_18 + leave FAIL + OK_18: + leave begin_19 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_19: + .try { + ldstr "test # 19" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000006e404fd398 + conv.u + ldc.i4 0x404fd398 + beq OK_19 + leave FAIL + OK_19: + leave begin_20 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_20: + .try { + ldstr "test # 20" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000252ccdff55 + conv.u + ldc.i4 0x2ccdff55 + beq OK_20 + leave FAIL + OK_20: + leave begin_21 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_21: + .try { + ldstr "test # 21" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000276118d2bdaa + conv.u + ldc.i4 0x18d2bdaa + beq OK_21 + leave FAIL + OK_21: + leave begin_22 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_22: + .try { + ldstr "test # 22" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00003ef8751db623 + conv.u + ldc.i4 0x751db623 + beq OK_22 + leave FAIL + OK_22: + leave begin_23 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_23: + .try { + ldstr "test # 23" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000eefbead97db0 + conv.u + ldc.i4 0xead97db0 + beq OK_23 + leave FAIL + OK_23: + leave begin_24 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_24: + .try { + ldstr "test # 24" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000d873ee6273ce + conv.u + ldc.i4 0xee6273ce + beq OK_24 + leave FAIL + OK_24: + leave begin_25 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_25: + .try { + ldstr "test # 25" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00562d105c4b017d + conv.u + ldc.i4 0x5c4b017d + beq OK_25 + leave FAIL + OK_25: + leave begin_26 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_26: + .try { + ldstr "test # 26" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0001f90ce65c3ecd + conv.u + ldc.i4 0xe65c3ecd + beq OK_26 + leave FAIL + OK_26: + leave begin_27 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_27: + .try { + ldstr "test # 27" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x007e901cfebdcaae + conv.u + ldc.i4 0xfebdcaae + beq OK_27 + leave FAIL + OK_27: + leave begin_28 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_28: + .try { + ldstr "test # 28" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0064eebedf02e9c6 + conv.u + ldc.i4 0xdf02e9c6 + beq OK_28 + leave FAIL + OK_28: + leave begin_29 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_29: + .try { + ldstr "test # 29" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0xfb60c56a5d39eaa4 + conv.u + ldc.i4 0x5d39eaa4 + beq OK_29 + leave FAIL + OK_29: + leave begin_30 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_30: + .try { + ldstr "test # 30" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x3cfb0f8bf8157095 + conv.u + ldc.i4 0xf8157095 + beq OK_30 + leave FAIL + OK_30: + leave begin_31 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_31: + .try { + ldstr "test # 31" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0xff4cef50a2b87120 + conv.u + ldc.i4 0xa2b87120 + beq OK_31 + leave FAIL + OK_31: + leave begin_32 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_32: + .try { + ldstr "test # 32" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x9462882f61a19634 + conv.u + ldc.i4 0x61a19634 + beq OK_32 + leave FAIL + OK_32: + leave begin_33 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_33: + + ldc.i4 0x64 + ldstr "passed" + br PRINT +FAIL: + ldc.i4.1 + ldstr "failed" +PRINT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/convovf_i8_i.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/convovf_i8_i.il new file mode 100644 index 0000000000..0a1f8666f4 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/convovf_i8_i.il @@ -0,0 +1,473 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + // Code size 48 (0x30) + .maxstack 5 +begin_1: + .try { + ldstr "test # 1" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000a0 + conv.ovf.i + ldc.i4 0x000000a0 + beq OK_1 + leave FAIL + OK_1: + leave begin_2 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_2: + .try { + ldstr "test # 2" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000027 + conv.ovf.i + ldc.i4 0x00000027 + beq OK_2 + leave FAIL + OK_2: + leave begin_3 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_3: + .try { + ldstr "test # 3" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000a1 + conv.ovf.i + ldc.i4 0x000000a1 + beq OK_3 + leave FAIL + OK_3: + leave begin_4 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_4: + .try { + ldstr "test # 4" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000b3 + conv.ovf.i + ldc.i4 0x000000b3 + beq OK_4 + leave FAIL + OK_4: + leave begin_5 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_5: + .try { + ldstr "test # 5" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000029ec + conv.ovf.i + ldc.i4 0x000029ec + beq OK_5 + leave FAIL + OK_5: + leave begin_6 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_6: + .try { + ldstr "test # 6" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000000bc27 + conv.ovf.i + ldc.i4 0x0000bc27 + beq OK_6 + leave FAIL + OK_6: + leave begin_7 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_7: + .try { + ldstr "test # 7" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000002040 + conv.ovf.i + ldc.i4 0x00002040 + beq OK_7 + leave FAIL + OK_7: + leave begin_8 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_8: + .try { + ldstr "test # 8" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000004fa6 + conv.ovf.i + ldc.i4 0x00004fa6 + beq OK_8 + leave FAIL + OK_8: + leave begin_9 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_9: + .try { + ldstr "test # 9" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000863096 + conv.ovf.i + ldc.i4 0x00863096 + beq OK_9 + leave FAIL + OK_9: + leave begin_10 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_10: + .try { + ldstr "test # 10" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000009234c5 + conv.ovf.i + ldc.i4 0x009234c5 + beq OK_10 + leave FAIL + OK_10: + leave begin_11 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_11: + .try { + ldstr "test # 11" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000d351e5 + conv.ovf.i + ldc.i4 0x00d351e5 + beq OK_11 + leave FAIL + OK_11: + leave begin_12 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_12: + .try { + ldstr "test # 12" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000032df2f + conv.ovf.i + ldc.i4 0x0032df2f + beq OK_12 + leave FAIL + OK_12: + leave begin_13 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_13: + .try { + ldstr "test # 13" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000002d0d6e01 + conv.ovf.i + ldc.i4 0x2d0d6e01 + beq OK_13 + leave FAIL + OK_13: + leave begin_14 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_14: + .try { + ldstr "test # 14" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000003b4b4ac4 + conv.ovf.i + ldc.i4 0x3b4b4ac4 + beq OK_14 + leave FAIL + OK_14: + leave begin_15 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_15: + .try { + ldstr "test # 15" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000007fbfa780 + conv.ovf.i + ldc.i4 0x7fbfa780 + beq OK_15 + leave FAIL + OK_15: + leave begin_16 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_16: + .try { + ldstr "test # 16" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000007a17e61a + conv.ovf.i + ldc.i4 0x7a17e61a + beq OK_16 + leave FAIL + OK_16: + leave begin_17 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_17: + .try { + ldstr "test # 17" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) +// ldc.i8 0x0000009e8211b75e +// conv.ovf.i +// pop +// leave FAIL + leave begin_33 + } catch [mscorlib]System.OverflowException { + pop + leave begin_18 + } +begin_18: + .try { + ldstr "test # 18" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000001a9c70412e + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_19 + } +begin_19: + .try { + ldstr "test # 19" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000ff92ab9a0f + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_20 + } +begin_20: + .try { + ldstr "test # 20" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000cb35d01001 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_21 + } +begin_21: + .try { + ldstr "test # 21" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000dfe3f33843ae + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_22 + } +begin_22: + .try { + ldstr "test # 22" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00007208b8ad3ff6 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_23 + } +begin_23: + .try { + ldstr "test # 23" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00002bbdc338cf11 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_24 + } +begin_24: + .try { + ldstr "test # 24" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00004bd52cec8f40 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_25 + } +begin_25: + .try { + ldstr "test # 25" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x001c0898bce41d8a + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_26 + } +begin_26: + .try { + ldstr "test # 26" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00769052acced36a + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_27 + } +begin_27: + .try { + ldstr "test # 27" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00200b84c6ebdb4e + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_28 + } +begin_28: + .try { + ldstr "test # 28" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00880c4f39fb2110 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_29 + } +begin_29: + .try { + ldstr "test # 29" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0xcd18f8b94c4173ea + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_30 + } +begin_30: + .try { + ldstr "test # 30" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0xc0311479f3cabd61 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_31 + } +begin_31: + .try { + ldstr "test # 31" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0xad12391d3bcf1551 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_32 + } +begin_32: + .try { + ldstr "test # 32" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0xc52cc15b10d62455 + conv.ovf.i + pop + leave FAIL + } catch [mscorlib]System.OverflowException { + pop + leave begin_33 + } +begin_33: + + ldc.i4 0x64 + ldstr "passed" + br PRINT +FAIL: + ldc.i4.1 + ldstr "failed" +PRINT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/convovf_i8_u-ia64.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/convovf_i8_u-ia64.il new file mode 100644 index 0000000000..3c6d0cca3c --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/convovf_i8_u-ia64.il @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + // Code size 48 (0x30) + .maxstack 5 +begin_1: + .try { + ldstr "test # 1" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000fd + conv.ovf.u + ldc.i4 0x000000fd + beq OK_1 + leave FAIL + OK_1: + leave begin_2 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_2: + .try { + ldstr "test # 2" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000000000a6 + conv.ovf.u + ldc.i4 0x000000a6 + beq OK_2 + leave FAIL + OK_2: + leave begin_3 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_3: + .try { + ldstr "test # 3" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000000004c + conv.ovf.u + ldc.i4 0x0000004c + beq OK_3 + leave FAIL + OK_3: + leave begin_4 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_4: + .try { + ldstr "test # 4" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000000069 + conv.ovf.u + ldc.i4 0x00000069 + beq OK_4 + leave FAIL + OK_4: + leave begin_5 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_5: + .try { + ldstr "test # 5" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000006917 + conv.ovf.u + ldc.i4 0x00006917 + beq OK_5 + leave FAIL + OK_5: + leave begin_6 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_6: + .try { + ldstr "test # 6" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000003910 + conv.ovf.u + ldc.i4 0x00003910 + beq OK_6 + leave FAIL + OK_6: + leave begin_7 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_7: + .try { + ldstr "test # 7" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000006d94 + conv.ovf.u + ldc.i4 0x00006d94 + beq OK_7 + leave FAIL + OK_7: + leave begin_8 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_8: + .try { + ldstr "test # 8" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000000b8d4 + conv.ovf.u + ldc.i4 0x0000b8d4 + beq OK_8 + leave FAIL + OK_8: + leave begin_9 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_9: + .try { + ldstr "test # 9" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000002709f1 + conv.ovf.u + ldc.i4 0x002709f1 + beq OK_9 + leave FAIL + OK_9: + leave begin_10 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_10: + .try { + ldstr "test # 10" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000bd498d + conv.ovf.u + ldc.i4 0x00bd498d + beq OK_10 + leave FAIL + OK_10: + leave begin_11 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_11: + .try { + ldstr "test # 11" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000000026e414 + conv.ovf.u + ldc.i4 0x0026e414 + beq OK_11 + leave FAIL + OK_11: + leave begin_12 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_12: + .try { + ldstr "test # 12" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x0000000000149abc + conv.ovf.u + ldc.i4 0x00149abc + beq OK_12 + leave FAIL + OK_12: + leave begin_13 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_13: + .try { + ldstr "test # 13" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000007f5ca797 + conv.ovf.u + ldc.i4 0x7f5ca797 + beq OK_13 + leave FAIL + OK_13: + leave begin_14 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_14: + .try { + ldstr "test # 14" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000ba989c83 + conv.ovf.u + ldc.i4 0xba989c83 + conv.u + beq OK_14 + leave FAIL + OK_14: + leave begin_15 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_15: + .try { + ldstr "test # 15" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x00000000ef5d6f3c + conv.ovf.u + ldc.i4 0xef5d6f3c + conv.u + beq OK_15 + leave FAIL + OK_15: + leave begin_16 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_16: + .try { + ldstr "test # 16" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i8 0x000000007ff93757 + conv.ovf.u + ldc.i4 0x7ff93757 + conv.u + beq OK_16 + leave FAIL + OK_16: + leave begin_17 + } catch [mscorlib]System.OverflowException { + pop + leave FAIL + } +begin_17: + ldc.i4 0x64 + ldstr "passed" + br PRINT +FAIL: + ldc.i4.1 + ldstr "failed" +PRINT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_conv.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_conv.il new file mode 100644 index 0000000000..06fd74a03b --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_conv.il @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static native int to_native(int32) il managed +{ + ldarg.0 + conv.ovf.i + ret +} +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + .maxstack 8 + //------------------------ + // I -> I4 conversion test + //------------------------ + .try { + ldc.i4 0x7fffffff + call native int Test::to_native(int32) + conv.ovf.i4 + ldc.i4 0x7fffffff + beq OK1_1 + leave FAIL + OK1_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native int Test::to_native(int32) + conv.ovf.i4 + ldc.i4.m1 + beq OK1_2 + leave FAIL + OK1_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // I -> I2 conversion test + //------------------------ + .try { + ldc.i4 0x7fffffff + call native int Test::to_native(int32) + conv.ovf.i2 + pop + leave FAIL + } catch [mscorlib]System.Exception { + pop + leave OK + } + .try { + ldc.i4 0x7fffffff + call native int Test::to_native(int32) + conv.i2 + ldc.i4.m1 + beq OK2_1 + leave FAIL + OK2_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4 0x7fff + call native int Test::to_native(int32) + conv.ovf.i2 + ldc.i4 0x7fff + beq OK2_2 + leave FAIL + OK2_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native int Test::to_native(int32) + conv.ovf.i2 + ldc.i4.m1 + beq OK2_3 + leave FAIL + OK2_3: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native int Test::to_native(int32) + conv.ovf.i2 + ldc.i4.m1 + beq OK2_4 + leave FAIL + OK2_4: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // I -> I1 conversion test + //------------------------ + .try { + ldc.i4 0x7fff + call native int Test::to_native(int32) + conv.ovf.i1 + pop + leave FAIL + } catch [mscorlib]System.Exception { + pop + leave OK + } + .try { + ldc.i4 0x7fff + call native int Test::to_native(int32) + conv.i1 + ldc.i4.m1 + beq OK3_1 + leave FAIL + OK3_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4 0x7f + call native int Test::to_native(int32) + conv.ovf.i1 + ldc.i4 0x7f + beq OK3_2 + leave FAIL + OK3_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // I -> U4 conversion test + //------------------------ + .try { + ldc.i4 0x7fffffff + call native int Test::to_native(int32) + conv.ovf.u4.un + ldc.i4 0x7fffffff + beq OK4_1 + leave FAIL + OK4_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native int Test::to_native(int32) + conv.ovf.u4 + ldc.i4.m1 + beq OK4_2 + leave FAIL + OK4_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // I -> U1 conversion test + //------------------------ + .try { + ldc.i4 0x7fff + call native int Test::to_native(int32) + conv.ovf.u1.un + pop + leave FAIL + } catch [mscorlib]System.Exception { + pop + leave OK + } + .try { + ldc.i4 0x7fff + call native int Test::to_native(int32) + conv.u1 + ldc.i4.m1 + beq OK5_1 + leave FAIL + OK5_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4 0x7f + call native int Test::to_native(int32) + conv.ovf.u1 + ldc.i4 0x7f + beq OK5_2 + leave FAIL + OK5_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // I -> R4 conversion test + //------------------------ + ldc.i4 0x7fff + dup + call native int Test::to_native(int32) + conv.r4 + conv.i + ceq + brfalse FAIL + ldc.i4 -1900 + dup + call native int Test::to_native(int32) + conv.r4 + conv.i + ceq + brfalse FAIL + //------------------------ + // I -> R8 conversion test + //------------------------ + ldc.i4 0x7fff + dup + call native int Test::to_native(int32) + conv.r8 + conv.i + ceq + brfalse FAIL + ldc.i4 -1900 + dup + call native int Test::to_native(int32) + conv.r8 + conv.i + ceq + brfalse FAIL + +OK: + ldc.i4 0x64 + ldstr "passed" + br PRINT +FAIL: + ldc.i4.1 + ldstr "failed" +PRINT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_fld.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_fld.il new file mode 100644 index 0000000000..e7c1f7d1c7 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_fld.il @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'qsort'// as "qsort" +{ } +.module 'qsort.exe' +.namespace Test +{ + .class private auto ansi AA extends [mscorlib]System.Object + { + .field public native int m_i + .field public static native int s_i + .field public native int[0...] m_ai + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + .maxstack 8 + .locals (class Test.AA pinned, native int[0...], native int, int32, native int[0...] pinned) + newobj instance void Test.AA::.ctor() + stloc.0 + + ldloc.0 + ldfld native int[0...] Test.AA::m_ai + stloc 4 + + + ldc.i4 18 + stloc.2 + + ldc.i4 19 + newobj instance void native int[0...]::.ctor(int32) + dup + dup + stloc.1 + dup + + ldc.i4 16 + ldsflda native int Test.AA::s_i + stelem.i + ldc.i4 17 + ldloc.0 + ldflda native int Test.AA::m_i + stelem.i + ldc.i4 18 + ldloca 2 + stelem.i + + ldc.i4.0 + stloc.3 + begin_init_loop: + ldloc.1 + ldloc.3 + ldloc.0 + ldfld native int[0...] Test.AA::m_ai + ldloc.3 + ldelema [mscorlib]System.IntPtr + stelem.i + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 16 + ceq + brfalse begin_init_loop + + ldc.i4.0 + dup + stloc.3 + + begin_sum_loop: + ldloc.1 + ldloc.3 + ldelem.i + ldind.i + add + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + + ldc.i4 19 + ceq + brfalse begin_sum_loop + + dup + call void [mscorlib]System.Console::WriteLine(int32) + ldc.i4 248 + beq stop + + ldc.i4.1 + ldstr "failed" + br exit + stop: + ldc.i4 0x64 + ldstr "passed" + exit: + + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret + } // end of method 'AA::Main' + + .method public static hidebysig specialname rtspecialname void .cctor() il managed + { + .maxstack 8 + ldc.i4 100 + stsfld native int Test.AA::s_i + ret + } // end of method 'AA::.ctor' + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + .maxstack 8 + .locals (int32) + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4 10 + stfld native int Test.AA::m_i + ldarg.0 + ldc.i4 16 + newobj instance void native int[0...]::.ctor(int32) + stfld native int[0...] Test.AA::m_ai + + ldc.i4.0 + br begin_loop + begin_loop: + dup + stloc.0 + ldarg.0 + ldfld native int[0...] Test.AA::m_ai + ldloc.0 + dup + stelem.i + + ldc.i4.1 + add + dup + ldc.i4 16 + ceq + brfalse begin_loop + end_loop: + pop + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flood.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flood.il new file mode 100644 index 0000000000..019d585615 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flood.il @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'avg'// as "avg" +{ +} +.module 'avg.exe' +// MVID: {BCA6096F-DF11-4FA3-BF16-EEDA01729535} +.namespace AvgTest { + .class private auto ansi Test extends [mscorlib]System.Object { + .method private hidebysig static int32 Main() il managed { + .entrypoint + .maxstack 8 + .locals(native int, native int) + ldc.i4.0 + stloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + br8: brtrue pop7 + br7: brfalse pop6 + br6: brfalse pop5 + br5: bge pop3 + br3: brtrue pop2 + br2: brtrue pop1 + br1: brfalse pop0 + br0: br pop0 + pop7: brtrue br6 + pop6: brfalse br5 + pop5: pop + pop4: brtrue br3 + pop3: brfalse br2 + pop2: brfalse br1 + pop1: brtrue br0 + pop0: ldc.i4 0x64 + ret + } // end of method 'Test::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Test::.ctor' + + } // end of class 'Test' + +} // end of namespace 'AvgTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flow.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flow.il new file mode 100644 index 0000000000..3d94dde068 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flow.il @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ +} +.module 'qsort.exe' +// MVID: {3433C0F8-3BEA-4168-AB0C-C275EF054928} +.namespace Test +{ + .class private auto ansi AA extends [mscorlib]System.Object + { + .field public native int m_i + .field public native int[0...] m_ai + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 8 + .locals (class Test.AA, native int i, native int& p1, native int& p2) + newobj instance void Test.AA::.ctor() + stloc.0 + + ldloc.0 + ldc.i4 0x80000000 + stfld native int Test.AA::m_i + + ldloc.0 + ldfld native int Test.AA::m_i + ldc.i4 0x7fffffff + bgt fail + + ldloc.0 + ldfld native int Test.AA::m_i + ldc.i4 0x80000001 + bgt fail + + ldloc.0 + ldfld native int Test.AA::m_i + ldc.i4 0x80000001 + conv.i + bgt.un fail + + ldc.i4.0 + stloc i + + again: + ldloc i + switch (a1,a2,a3,a4,a5,a6,stop) + a1: + ldloca i + br merge_1 + a2: + ldloca i + merge_2: + ldloc.0 + ldfld native int[0...] Test.AA::m_ai + ldc.i4.1 + ldelema [mscorlib]System.IntPtr + br final_merge + a3: + ldloc.0 + ldflda native int Test.AA::m_i + merge_3: + ldloca i + br final_merge + a4: + ldloc.0 + ldflda native int Test.AA::m_i + br merge_2 + a5: + ldloc.0 + ldfld native int[0...] Test.AA::m_ai + ldc.i4.1 + ldelema [mscorlib]System.IntPtr + br merge_3 + a6: + ldloc.0 + ldfld native int[0...] Test.AA::m_ai + ldc.i4.1 + ldelema [mscorlib]System.IntPtr + merge_1: + ldloc.0 + ldflda native int Test.AA::m_i + final_merge: + stloc p1 + stloc p2 + ldloc p1 + ldloc p2 + beq fail + + ldloc p1 + ldind.i + dup + ldloc p2 + ldind.i + add + sub + ldloc p2 + ldind.i + ceq + brfalse fail + + ldloca i + ldloc i + ldc.i4.1 + add.ovf.un + stind.i + + stop: + ldc.i4 0x64 + ldstr "passed" + br exit + + fail: + ldc.i4.1 + ldstr "failed" + exit: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret + } // end of method 'AA::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4.0 + stfld native int Test.AA::m_i + ldarg.0 + ldc.i4.8 + newobj instance void native int[0...]::.ctor(int32) + stfld native int[0...] Test.AA::m_ai + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flow_merge.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flow_merge.il new file mode 100644 index 0000000000..33a5a7ffe2 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_flow_merge.il @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + .maxstack 4 + .locals (int32, native int, native int) + ldc.i4.0 + dup + stloc.0 + stloc.1 + + ldc.i4 0x12345678 + stloc.2 + + ldc.i4.0 + br.s loop_begin +loop_begin: + dup + brfalse branch1 + ldloca 0 + ldstr "branch1" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + br.s merge1 +branch1: + ldstr "branch2" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldloca 1 +merge1: + ldloca 2 + ldind.i + stind.i + ldc.i4.1 + add + dup + ldc.i4.2 + ceq + brfalse.s loop_begin + pop + + ldloc.0 + ldloc.1 + add + ldloca 2 + ldind.i + sub + ldloc.2 + sub + ldc.i4 0x64 + add + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_prop.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_prop.il new file mode 100644 index 0000000000..ec251b6b5c --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_prop.il @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'qsort'// as "qsort" +{ } +.module 'qsort.exe' +.namespace Test +{ + .class private auto ansi BB extends [mscorlib]System.Object + { + .method private hidebysig static int32 Main() il managed + { + .entrypoint + .maxstack 8 + .locals (class Test.AA) + + newobj instance void Test.AA::.ctor() + stloc.0 + ldloc.0 + ldc.i4.0 + call instance void Test.AA::set_I(native int) + ldloc.0 + call instance native int Test.AA::get_I() + ldstr "passed" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i4 0x64 + add + ret + } // end of method 'AA::Main' + + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } // end of method 'AA::.ctor' + } + .class private auto ansi AA extends [mscorlib]System.Object + { + .field private native int m_i + + .method public native int get_I() il managed + { + .maxstack 8 + ldarg.0 + ldfld native int Test.AA::m_i + ret + } + + .method public void set_I(native int) il managed + { + .maxstack 8 + ldarg.0 + ldarg.1 + stfld native int Test.AA::m_i + ret + } + + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4.0 + stfld native int Test.AA::m_i + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_qsort1.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_qsort1.il new file mode 100644 index 0000000000..4c88b4444f --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_qsort1.il @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ + .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true ) +} +.module 'qsort.exe' +// MVID: {D2333E3D-2CA6-4703-8D46-E41A46BDF801} +.namespace QSortTest +{ + .class private auto ansi Sorter + extends [mscorlib]System.Object + { + .method private hidebysig static void Sort(native int[] A, + native int L, native int H) il managed + { + // Code size 178 (0xb2) + .maxstack 5 + .locals (native int[] V_0, + native int V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: bge IL_00b1 + + IL_0007: ldc.i4.s 64 + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.0 + IL_000f: ldc.i4.0 + IL_0010: stloc.1 + IL_0011: br IL_00ac + + IL_0016: ldarg.1 + IL_0017: ldc.i4.1 + IL_0018: sub + IL_0019: stloc.2 + IL_001a: ldarg.2 + IL_001b: ldc.i4.1 + IL_001c: add + IL_001d: stloc.3 + IL_001e: ldarg.0 + IL_001f: ldarg.1 + IL_0020: ldarg.2 + IL_0021: add + IL_0022: ldc.i4.2 + IL_0023: div + IL_0024: ldelem.i + IL_0025: stloc.s V_4 + IL_0027: br.s IL_0067 + + IL_0029: br.s IL_002b + + IL_002b: ldarg.0 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: sub + IL_002f: dup + IL_0030: stloc.3 + IL_0031: ldelem.i + IL_0032: ldloc.s V_4 + IL_0034: bgt.s IL_002b + + IL_0036: br.s IL_0038 + + IL_0038: ldarg.0 + IL_0039: ldloc.2 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: dup + IL_003d: stloc.2 + IL_003e: ldelem.i + IL_003f: ldloc.s V_4 + IL_0041: blt.s IL_0038 + + IL_0043: ldloc.2 + IL_0044: ldloc.3 + IL_0045: blt.s IL_0049 + + IL_0047: br.s IL_0069 + + IL_0049: ldarg.0 + IL_004a: ldloc.2 + IL_004b: ldarg.0 + IL_004c: ldloc.2 + IL_004d: ldelem.i + IL_004e: ldarg.0 + IL_004f: ldloc.3 + IL_0050: ldelem.i + IL_0051: xor + IL_0052: stelem.i + IL_0053: ldarg.0 + IL_0054: ldloc.3 + IL_0055: ldarg.0 + IL_0056: ldloc.2 + IL_0057: ldelem.i + IL_0058: ldarg.0 + IL_0059: ldloc.3 + IL_005a: ldelem.i + IL_005b: xor + IL_005c: stelem.i + IL_005d: ldarg.0 + IL_005e: ldloc.2 + IL_005f: ldarg.0 + IL_0060: ldloc.2 + IL_0061: ldelem.i + IL_0062: ldarg.0 + IL_0063: ldloc.3 + IL_0064: ldelem.i + IL_0065: xor + IL_0066: stelem.i + IL_0067: br.s IL_0029 + + IL_0069: ldarg.1 + IL_006a: ldloc.3 + IL_006b: bge.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldloc.1 + IL_006f: dup + IL_0070: ldc.i4.1 + IL_0071: add + IL_0072: stloc.1 + IL_0073: ldarg.1 + IL_0074: stelem.i + IL_0075: ldloc.0 + IL_0076: ldloc.1 + IL_0077: dup + IL_0078: ldc.i4.1 + IL_0079: add + IL_007a: stloc.1 + IL_007b: ldloc.3 + IL_007c: stelem.i + IL_007d: ldloc.3 + IL_007e: ldc.i4.1 + IL_007f: add + IL_0080: ldarg.2 + IL_0081: bge.s IL_0095 + + IL_0083: ldloc.0 + IL_0084: ldloc.1 + IL_0085: dup + IL_0086: ldc.i4.1 + IL_0087: add + IL_0088: stloc.1 + IL_0089: ldloc.3 + IL_008a: ldc.i4.1 + IL_008b: add + IL_008c: stelem.i + IL_008d: ldloc.0 + IL_008e: ldloc.1 + IL_008f: dup + IL_0090: ldc.i4.1 + IL_0091: add + IL_0092: stloc.1 + IL_0093: ldarg.2 + IL_0094: stelem.i + IL_0095: ldloc.1 + IL_0096: brtrue.s IL_009a + + IL_0098: br.s IL_00b1 + + IL_009a: ldloc.0 + IL_009b: ldloc.1 + IL_009c: ldc.i4.1 + IL_009d: sub + IL_009e: dup + IL_009f: stloc.1 + IL_00a0: ldelem.i + IL_00a1: starg.s H + IL_00a3: ldloc.0 + IL_00a4: ldloc.1 + IL_00a5: ldc.i4.1 + IL_00a6: sub + IL_00a7: dup + IL_00a8: stloc.1 + IL_00a9: ldelem.i + IL_00aa: starg.s L + IL_00ac: br IL_0016 + + IL_00b1: ret + } // end of method 'Sorter::Sort' + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 4 + .locals (native int V_0, + native int[] V_1, + native int V_2, + native int V_3, + native int V_4, + native int V_5) + IL_0000: ldc.i4 0x1f40 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.1 + IL_000f: ldloc.0 + IL_0010: ldc.i4 0x7cf + IL_0015: mul + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: stloc.3 + IL_0019: br.s IL_0031 + + IL_001b: ldloc.1 + IL_001c: ldloc.3 + IL_001d: ldloc.2 + IL_001e: ldc.i4.s 19 + IL_0020: add.ovf + IL_0021: ldc.i4.s 17 + IL_0023: mul.ovf + IL_0024: ldc.i4 0x7cf + IL_0029: rem + IL_002a: dup + IL_002b: stloc.2 + ldc.i4 600 + sub + IL_002c: stelem.i + IL_002d: ldloc.3 + IL_002e: ldc.i4.1 + IL_002f: add + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: ldloc.0 + IL_0033: ble.s IL_001b + + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: ldloc.0 + IL_0038: call void QSortTest.Sorter::Sort(native int[], + native int, + native int) + IL_003d: ldc.i4.2 + IL_003e: stloc.s V_4 + IL_0040: br.s IL_006f + + IL_0042: ldloc.1 + IL_0043: ldloc.s V_4 + IL_0045: ldc.i4.1 + IL_0046: sub + IL_0047: ldelem.i + IL_0048: ldloc.1 + IL_0049: ldloc.s V_4 + IL_004b: ldelem.i + IL_004c: ble.s IL_0069 + + IL_004e: ldstr "Test failed at index " + IL_0053: ldloca.s V_4 + IL_0055: call instance class [mscorlib]System.String [mscorlib]System.IntPtr::ToString() + IL_005a: call class [mscorlib]System.String [mscorlib]System.String::Concat(class [mscorlib]System.String, + class [mscorlib]System.String) + IL_005f: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_0064: ldc.i4.1 + IL_0065: stloc.s V_5 + IL_0067: br.s IL_0083 + + IL_0069: ldloc.s V_4 + IL_006b: ldc.i4.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.s V_4 + IL_0071: ldloc.0 + IL_0072: ble.s IL_0042 + + IL_0074: ldstr "qsort test passed" + IL_0079: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_007e: ldc.i4 0x64 + IL_007f: stloc.s V_5 + IL_0081: br.s IL_0083 + + IL_0083: ldloc.s V_5 + IL_0085: ret + } // end of method 'Sorter::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Sorter::.ctor' + + } // end of class 'Sorter' + +} // end of namespace 'QSortTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_qsort2.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_qsort2.il new file mode 100644 index 0000000000..d2a6a89b58 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_qsort2.il @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ + .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true ) +} +.module 'qsort.exe' +// MVID: {D2333E3D-2CA6-4703-8D46-E41A46BDF801} +.namespace QSortTest +{ + .class private auto ansi Sorter + extends [mscorlib]System.Object + { + .method private hidebysig static void Sort(native int[] A, + native int L, native int H) il managed + { + // Code size 178 (0xb2) + .maxstack 5 + .locals (native int[] V_0, + native int V_1, + native int V_2, + native int V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: bge IL_00b1 + + IL_0007: ldc.i4.s 64 + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.0 + IL_000f: ldc.i4.0 + IL_0010: stloc.1 + IL_0011: br IL_00ac + + IL_0016: ldarg.1 + IL_0017: ldc.i4.1 + IL_0018: sub + IL_0019: stloc.2 + IL_001a: ldarg.2 + IL_001b: ldc.i4.1 + IL_001c: add + IL_001d: stloc.3 + IL_001e: ldarg.0 + IL_001f: ldarg.1 + IL_0020: ldarg.2 + IL_0021: add + IL_0022: ldc.i4.2 + IL_0023: div + IL_0024: ldelem.i4 + IL_0025: stloc.s V_4 + IL_0027: br.s IL_0067 + + IL_0029: br.s IL_002b + + IL_002b: ldarg.0 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: sub + IL_002f: dup + IL_0030: stloc.3 + IL_0031: ldelem.i4 + IL_0032: ldloc.s V_4 + IL_0034: bgt.s IL_002b + + IL_0036: br.s IL_0038 + + IL_0038: ldarg.0 + IL_0039: ldloc.2 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: dup + IL_003d: stloc.2 + IL_003e: ldelem.i4 + IL_003f: ldloc.s V_4 + IL_0041: blt.s IL_0038 + + IL_0043: ldloc.2 + IL_0044: ldloc.3 + IL_0045: blt.s IL_0049 + + IL_0047: br.s IL_0069 + + IL_0049: ldarg.0 + IL_004a: ldloc.2 + IL_004b: ldarg.0 + IL_004c: ldloc.2 + IL_004d: ldelem.i4 + IL_004e: ldarg.0 + IL_004f: ldloc.3 + IL_0050: ldelem.i4 + IL_0051: xor + IL_0052: stelem.i4 + IL_0053: ldarg.0 + IL_0054: ldloc.3 + IL_0055: ldarg.0 + IL_0056: ldloc.2 + IL_0057: ldelem.i4 + IL_0058: ldarg.0 + IL_0059: ldloc.3 + IL_005a: ldelem.i4 + IL_005b: xor + IL_005c: stelem.i4 + IL_005d: ldarg.0 + IL_005e: ldloc.2 + IL_005f: ldarg.0 + IL_0060: ldloc.2 + IL_0061: ldelem.i4 + IL_0062: ldarg.0 + IL_0063: ldloc.3 + IL_0064: ldelem.i4 + IL_0065: xor + IL_0066: stelem.i4 + IL_0067: br.s IL_0029 + + IL_0069: ldarg.1 + IL_006a: ldloc.3 + IL_006b: bge.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldloc.1 + IL_006f: dup + IL_0070: ldc.i4.1 + IL_0071: add + IL_0072: stloc.1 + IL_0073: ldarg.1 + IL_0074: stelem.i4 + IL_0075: ldloc.0 + IL_0076: ldloc.1 + IL_0077: dup + IL_0078: ldc.i4.1 + IL_0079: add + IL_007a: stloc.1 + IL_007b: ldloc.3 + IL_007c: stelem.i4 + IL_007d: ldloc.3 + IL_007e: ldc.i4.1 + IL_007f: add + IL_0080: ldarg.2 + IL_0081: bge.s IL_0095 + + IL_0083: ldloc.0 + IL_0084: ldloc.1 + IL_0085: dup + IL_0086: ldc.i4.1 + IL_0087: add + IL_0088: stloc.1 + IL_0089: ldloc.3 + IL_008a: ldc.i4.1 + IL_008b: add + IL_008c: stelem.i4 + IL_008d: ldloc.0 + IL_008e: ldloc.1 + IL_008f: dup + IL_0090: ldc.i4.1 + IL_0091: add + IL_0092: stloc.1 + IL_0093: ldarg.2 + IL_0094: stelem.i4 + IL_0095: ldloc.1 + IL_0096: brtrue.s IL_009a + + IL_0098: br.s IL_00b1 + + IL_009a: ldloc.0 + IL_009b: ldloc.1 + IL_009c: ldc.i4.1 + IL_009d: sub + IL_009e: dup + IL_009f: stloc.1 + IL_00a0: ldelem.i4 + IL_00a1: starg.s H + IL_00a3: ldloc.0 + IL_00a4: ldloc.1 + IL_00a5: ldc.i4.1 + IL_00a6: sub + IL_00a7: dup + IL_00a8: stloc.1 + IL_00a9: ldelem.i4 + IL_00aa: starg.s L + IL_00ac: br IL_0016 + + IL_00b1: ret + } // end of method 'Sorter::Sort' + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 4 + .locals (native int V_0, + native int[] V_1, + native int V_2, + native int V_3, + native int V_4, + native int V_5) + IL_0000: ldc.i4 0x1f40 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.1 + IL_000f: ldloc.0 + IL_0010: ldc.i4 0x7cf + IL_0015: mul + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: stloc.3 + IL_0019: br.s IL_0031 + + IL_001b: ldloc.1 + IL_001c: ldloc.3 + IL_001d: ldloc.2 + IL_001e: ldc.i4.s 19 + IL_0020: add.ovf + IL_0021: ldc.i4.s 17 + IL_0023: mul.ovf + IL_0024: ldc.i4 0x7cf + IL_0029: rem + IL_002a: dup + IL_002b: stloc.2 + ldc.i4 600 + sub + IL_002c: stelem.i4 + IL_002d: ldloc.3 + IL_002e: ldc.i4.1 + IL_002f: add + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: ldloc.0 + IL_0033: ble.s IL_001b + + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: ldloc.0 + IL_0038: call void QSortTest.Sorter::Sort(native int[], + native int, + native int) + IL_003d: ldc.i4.2 + IL_003e: stloc.s V_4 + IL_0040: br.s IL_006f + + IL_0042: ldloc.1 + IL_0043: ldloc.s V_4 + IL_0045: ldc.i4.1 + IL_0046: sub + IL_0047: ldelem.i4 + IL_0048: ldloc.1 + IL_0049: ldloc.s V_4 + IL_004b: ldelem.i4 + IL_004c: ble.s IL_0069 + + IL_004e: ldstr "Test failed at index " + IL_0053: ldloca.s V_4 + IL_0055: call instance class [mscorlib]System.String [mscorlib]System.IntPtr::ToString() + IL_005a: call class [mscorlib]System.String [mscorlib]System.String::Concat(class [mscorlib]System.String, + class [mscorlib]System.String) + IL_005f: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_0064: ldc.i4.1 + IL_0065: stloc.s V_5 + IL_0067: br.s IL_0083 + + IL_0069: ldloc.s V_4 + IL_006b: ldc.i4.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.s V_4 + IL_0071: ldloc.0 + IL_0072: ble.s IL_0042 + + IL_0074: ldstr "qsort test passed" + IL_0079: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_007e: ldc.i4 0x64 + IL_007f: stloc.s V_5 + IL_0081: br.s IL_0083 + + IL_0083: ldloc.s V_5 + IL_0085: ret + } // end of method 'Sorter::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Sorter::.ctor' + + } // end of class 'Sorter' + +} // end of namespace 'QSortTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_ref.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_ref.il new file mode 100644 index 0000000000..9754458c47 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_ref.il @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'avg'// as "avg" +{ +} +.module 'avg.exe' +// MVID: {BCA6096F-DF11-4FA3-BF16-EEDA01729535} +.namespace AvgTest +{ + .class private auto ansi Test + extends [mscorlib]System.Object + { + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 48 (0x30) + .maxstack 5 + .locals(native int) + ldc.i4.1 + stloc.0 + ldloca 0 + mkrefany [mscorlib]System.IntPtr + ldc.i4.0 + stloc.0 + refanyval [mscorlib]System.IntPtr + ldind.i + ldc.i4 0x64 + add + ret + } // end of method 'Test::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Test::.ctor' + + } // end of class 'Test' + +} // end of namespace 'AvgTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_seq.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_seq.il new file mode 100644 index 0000000000..80a402e68d --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_seq.il @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static native int calc(native int, native int) il managed +{ + .maxstack 8 + .locals (native int) + ldarg.1 + stloc.0 + ldloc.0 + br again +again: + ldarg.0 + brfalse.s stop + ldarg.0 + ldarg.1 + switch (sum,fact) + pop + br stop +sum: + add + br.s cont +fact: + mul +cont: + ldarg.0 + ldc.i4.1 + sub + starg 0 + br again +stop: + ret +} + +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + .maxstack 5 + ldc.i4.s 6 + ldc.i4.1 + call native int Test::calc(native int, native int) + ldc.i4 720 + conv.i + ceq + brfalse ERROR + ldc.i4.s 6 + ldc.i4.0 + call native int Test::calc(native int, native int) + ldc.i4 21 + conv.i + ceq + brfalse ERROR + ldc.i4 0x64 + ldstr "PASSED" + br EXIT +ERROR: + ldc.i4.1 + ldstr "FAILED" +EXIT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret +} +} diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_vfld.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_vfld.il new file mode 100644 index 0000000000..4363e86c8d --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/i_vfld.il @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'qsort'// as "qsort" +{ } +.module 'qsort.exe' +.namespace Test +{ + .class private value sealed auto ansi AA extends [mscorlib]System.ValueType + { + .field public native int m_i + .field public static native int s_i + .field public native int[0...] m_ai + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + .maxstack 8 + .locals (value class Test.AA pinned, native int[0...], native int, int32, native int[0...] pinned) + newobj instance void Test.AA::.ctor() + stloc.0 + + + ldloc.0 + ldfld native int[0...] Test.AA::m_ai + stloc 4 + + ldc.i4 18 + stloc.2 + + ldc.i4 19 + newobj instance void native int[0...]::.ctor(int32) + dup + dup + stloc.1 + dup + + ldc.i4 16 + ldsflda native int Test.AA::s_i + stelem.i + ldc.i4 17 + ldloca 0 + ldflda native int Test.AA::m_i + stelem.i + ldc.i4 18 + ldloca 2 + stelem.i + + ldc.i4.0 + stloc.3 + begin_init_loop: + ldloc.1 + ldloc.3 + ldloca 0 + ldfld native int[0...] Test.AA::m_ai + ldloc.3 + ldelema [mscorlib]System.IntPtr + stelem.i + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 16 + ceq + brfalse begin_init_loop + + ldc.i4.0 + dup + stloc.3 + begin_sum_loop: + ldloc.1 + ldloc.3 + ldelem.i + ldind.i + add + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 19 + ceq + brfalse begin_sum_loop + + dup + call void [mscorlib]System.Console::WriteLine(int32) + ldc.i4 248 + beq stop + + ldc.i4.1 + ldstr "failed" + br exit + stop: + ldc.i4 0x64 + ldstr "passed" + exit: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret + } // end of method 'AA::Main' + + .method public static hidebysig specialname rtspecialname void .cctor() il managed + { + .maxstack 8 + ldc.i4 100 + stsfld native int Test.AA::s_i + ret + } // end of method 'AA::.ctor' + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + .maxstack 8 + .locals (int32) + //ldarg.0 + //call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4 10 + stfld native int Test.AA::m_i + ldarg.0 + ldc.i4 16 + newobj instance void native int[0...]::.ctor(int32) + stfld native int[0...] Test.AA::m_ai + + ldc.i4.0 + br begin_loop + begin_loop: + dup + stloc.0 + ldarg.0 + ldfld native int[0...] Test.AA::m_ai + ldloc.0 + dup + stelem.i + ldc.i4.1 + add + dup + ldc.i4 16 + ceq + brfalse begin_loop + end_loop: + pop + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/il_template.proj b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/il_template.proj new file mode 100644 index 0000000000..cd6913e79e --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/il_template.proj @@ -0,0 +1,42 @@ +<?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>$(AssemblyName1)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + <RestorePackages>true</RestorePackages> + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + <ProjectLanguage>IL</ProjectLanguage> + </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> + <ItemGroup> + <Compile Include="$(AssemblyName1).il" /> + </ItemGroup> + <ItemGroup> + <None Include="packages.config" /> + <None Include="app.config" /> + </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/Methodical/ELEMENT_TYPE_IU/packages.config b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/packages.config new file mode 100644 index 0000000000..37e10b961a --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/packages.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="System.Console" version="4.0.0-beta-22405" /> + <package id="System.Runtime" version="4.0.20-beta-22405" /> + <package id="System.Runtime.Extensions" version="4.0.10-beta-22412" /> +</packages>
\ No newline at end of file diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/ptr.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/ptr.il new file mode 100644 index 0000000000..97e8d4e4b6 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/ptr.il @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +//.corflags 0x00000002 +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.module 'test.exe' +// MVID: {6048B3F7-DE21-4008-935A-6B43C5338841} +.class value private explicit ansi sealed $MultiByte$size$120 +{ + .pack 1 + .size 120 +} // end of class '$MultiByte$size$120' + +.class value private explicit ansi sealed $MultiByte$size$7 +{ + .pack 1 + .size 7 +} // end of class '$MultiByte$size$7' + +.class value private explicit ansi sealed $MultiByte$size$32000 +{ + .pack 1 + .size 32000 +} // end of class '$MultiByte$size$32000' + +.class AA { +.method public static void qsort(native unsigned int A_0, + unsigned int32 A_1, + unsigned int32 A_2, + method int32 *(native unsigned int, native unsigned int) A_3) il managed +{ + .maxstack 4 + .locals (int8 * V_0, + int32 V_1, + int8 * V_2, + int8 * V_3, + int8 * V_4, + native uint V_5, + int8 * V_6, + value class $MultiByte$size$120 V_7, + value class $MultiByte$size$120 V_8) + IL_0000: ldarg.1 + IL_0001: ldc.i4.2 + IL_0002: blt.un.s IL_0007 + + IL_0004: ldarg.2 + IL_0005: brtrue.s IL_000c + + IL_0007: br IL_010d + + IL_000c: ldc.i4.0 + IL_000d: stloc.1 + IL_000e: ldarg.0 + IL_000f: stloc.0 + IL_0010: ldarg.0 + IL_0011: ldarg.2 + IL_0012: ldarg.1 + IL_0013: ldc.i4.1 + IL_0014: sub + IL_0015: mul + IL_0016: add + IL_0017: stloc.s V_4 + IL_0019: ldloc.s V_4 + IL_001b: ldloc.0 + IL_001c: sub + IL_001d: ldarg.2 + IL_001e: div.un + IL_001f: ldc.i4.1 + IL_0020: add + IL_0021: stloc.s V_5 + IL_0023: ldloc.s V_5 + IL_0025: ldc.i4.8 + IL_0026: bgt.un.s IL_0037 + + IL_0028: ldloc.0 + IL_0029: ldloc.s V_4 + IL_002b: ldarg.2 + IL_002c: ldarg.3 + IL_002d: call void AA::shortsort(native unsigned int, native unsigned int, unsigned int32, method int32 *(native unsigned int,native unsigned int)) + IL_0032: br IL_00ef + + IL_0037: ldloc.0 + IL_0038: ldloc.s V_5 + IL_003a: ldc.i4 2 + conv.u + IL_003b: div.un + IL_003c: ldarg.2 + IL_003d: mul + IL_003e: add + IL_003f: stloc.s V_6 + IL_0041: ldloc.s V_6 + IL_0043: ldloc.0 + IL_0044: ldarg.2 + IL_0045: call void AA::swap(native unsigned int, native unsigned int, unsigned int32) + IL_004a: ldloc.0 + IL_004b: stloc.3 + IL_004c: ldloc.s V_4 + IL_004e: ldarg.2 + IL_004f: add + IL_0050: stloc.2 + IL_0051: ldloc.3 + IL_0052: ldarg.2 + IL_0053: add + IL_0054: stloc.3 + IL_0055: ldloc.3 + IL_0056: ldloc.s V_4 + IL_0058: bgt.un.s IL_0065 + + IL_005a: ldloc.3 + IL_005b: ldloc.0 + IL_005c: ldarg.3 + IL_005d: calli int32 (native unsigned int,native unsigned int) + IL_0062: ldc.i4.0 + IL_0063: ble.s IL_0051 + + IL_0065: ldloc.2 + IL_0066: ldarg.2 + IL_0067: sub + IL_0068: stloc.2 + IL_0069: ldloc.2 + IL_006a: ldloc.0 + IL_006b: ble.un.s IL_0078 + + IL_006d: ldloc.2 + IL_006e: ldloc.0 + IL_006f: ldarg.3 + IL_0070: calli int32 (native unsigned int,native unsigned int) + IL_0075: ldc.i4.0 + IL_0076: bge.s IL_0065 + + IL_0078: ldloc.2 + IL_0079: ldloc.3 + IL_007a: bge.un.s IL_007e + + IL_007c: br.s IL_0088 + + IL_007e: ldloc.3 + IL_007f: ldloc.2 + IL_0080: ldarg.2 + IL_0081: call void AA::swap(native unsigned int, native unsigned int, unsigned int32) + IL_0086: br.s IL_0051 + + IL_0088: ldloc.0 + IL_0089: ldloc.2 + IL_008a: ldarg.2 + IL_008b: call void AA::swap(native unsigned int, native unsigned int, unsigned int32) + IL_0090: ldloc.2 + IL_0091: ldc.i4.1 + IL_0092: sub + IL_0093: ldloc.0 + IL_0094: sub + IL_0095: ldloc.s V_4 + IL_0097: ldloc.3 + IL_0098: sub + IL_0099: blt.s IL_00c5 + + IL_009b: ldloc.0 + IL_009c: ldarg.2 + IL_009d: add + IL_009e: ldloc.2 + IL_009f: bge.un.s IL_00b7 + + IL_00a1: ldloca.s V_8 + IL_00a3: ldloc.1 + IL_00a4: ldc.i4.8 + IL_00a5: mul + IL_00a6: add + IL_00a7: ldloc.0 + IL_00a8: stind.i + IL_00a9: ldloca.s V_7 + IL_00ab: ldloc.1 + IL_00ac: ldc.i4.8 + IL_00ad: mul + IL_00ae: add + IL_00af: ldloc.2 + IL_00b0: ldarg.2 + IL_00b1: sub + IL_00b2: stind.i + IL_00b3: ldloc.1 + IL_00b4: ldc.i4.1 + IL_00b5: add + IL_00b6: stloc.1 + IL_00b7: ldloc.3 + IL_00b8: ldloc.s V_4 + IL_00ba: bge.un.s IL_00c3 + + IL_00bc: ldloc.3 + IL_00bd: stloc.0 + IL_00be: br IL_0019 + + IL_00c3: br.s IL_00ef + + IL_00c5: ldloc.3 + IL_00c6: ldloc.s V_4 + IL_00c8: bge.un.s IL_00df + + IL_00ca: ldloca.s V_8 + IL_00cc: ldloc.1 + IL_00cd: ldc.i4.8 + IL_00ce: mul + IL_00cf: add + IL_00d0: ldloc.3 + IL_00d1: stind.i + IL_00d2: ldloca.s V_7 + IL_00d4: ldloc.1 + IL_00d5: ldc.i4.8 + IL_00d6: mul + IL_00d7: add + IL_00d8: ldloc.s V_4 + IL_00da: stind.i + IL_00db: ldloc.1 + IL_00dc: ldc.i4.1 + IL_00dd: add + IL_00de: stloc.1 + IL_00df: ldloc.0 + IL_00e0: ldarg.2 + IL_00e1: add + IL_00e2: ldloc.2 + IL_00e3: bge.un.s IL_00ef + + IL_00e5: ldloc.2 + IL_00e6: ldarg.2 + IL_00e7: sub + IL_00e8: stloc.s V_4 + IL_00ea: br IL_0019 + + IL_00ef: ldloc.1 + IL_00f0: ldc.i4.1 + IL_00f1: sub + IL_00f2: stloc.1 + IL_00f3: ldloc.1 + IL_00f4: ldc.i4.0 + IL_00f5: blt.s IL_010d + + IL_00f7: ldloca.s V_8 + IL_00f9: ldloc.1 + IL_00fa: ldc.i4.8 + IL_00fb: mul + IL_00fc: add + IL_00fd: ldind.i + IL_00fe: stloc.0 + IL_00ff: ldloca.s V_7 + IL_0101: ldloc.1 + IL_0102: ldc.i4.8 + IL_0103: mul + IL_0104: add + IL_0105: ldind.i + IL_0106: stloc.s V_4 + IL_0108: br IL_0019 + + IL_010d: ret +} // end of global method 'qsort' + +.method public static void + shortsort(native unsigned int A_0, native unsigned int A_1, + unsigned int32 A_2, method int32 *(native unsigned int, + native unsigned int) A_3) il managed +{ + .vtentry 2 : 1 + // Code size 51 (0x33) + .maxstack 3 + .locals (int8 * V_0, + int8 * V_1) + IL_0000: ldarg.1 + IL_0001: ldarg.0 + IL_0002: ble.un.s IL_0032 + + IL_0004: ldarg.0 + IL_0005: stloc.1 + IL_0006: ldarg.0 + IL_0007: ldarg.2 + IL_0008: add + IL_0009: stloc.0 + IL_000a: br.s IL_0010 + + IL_000c: ldloc.0 + IL_000d: ldarg.2 + IL_000e: add + IL_000f: stloc.0 + IL_0010: ldloc.0 + IL_0011: ldarg.1 + IL_0012: bgt.un.s IL_0023 + + IL_0014: ldloc.0 + IL_0015: ldloc.1 + IL_0016: ldarg.3 + IL_0017: calli int32 (native unsigned int,native unsigned int) + IL_001c: ldc.i4.0 + IL_001d: ble.s IL_0021 + + IL_001f: ldloc.0 + IL_0020: stloc.1 + IL_0021: br.s IL_000c + + IL_0023: ldloc.1 + IL_0024: ldarg.1 + IL_0025: ldarg.2 + IL_0026: call void AA::swap(native unsigned int, native unsigned int, unsigned int32) + IL_002b: ldarg.1 + IL_002c: ldarg.2 + IL_002d: sub + IL_002e: starg.s A_1 + IL_0030: br.s IL_0000 + + IL_0032: ret +} // end of global method 'shortsort' + +.method public static void swap(native unsigned int A_0, native unsigned int A_1, unsigned int32 A_2) il managed +{ + .vtentry 3 : 1 + // Code size 35 (0x23) + .maxstack 3 + .locals (int8 V_0) + IL_0000: ldarg.0 + IL_0001: ldarg.1 + IL_0002: beq.s IL_0022 + + IL_0004: ldarg.2 + IL_0005: ldarg.2 + IL_0006: ldc.i4.1 + IL_0007: sub + IL_0008: starg.s A_2 + IL_000a: brfalse.s IL_0022 + + IL_000c: ldarg.0 + IL_000d: ldind.i1 + IL_000e: stloc.0 + IL_000f: ldarg.0 + IL_0010: ldarg.1 + IL_0011: ldind.i1 + IL_0012: stind.i1 + IL_0013: ldarg.0 + IL_0014: ldc.i4.1 + IL_0015: add + IL_0016: starg.s A_0 + IL_0018: ldarg.1 + IL_0019: ldloc.0 + IL_001a: stind.i1 + IL_001b: ldarg.1 + IL_001c: ldc.i4.1 + IL_001d: add + IL_001e: starg.s A_1 + IL_0020: br.s IL_0004 + + IL_0022: ret +} // end of global method 'swap' + +.method public static int32 mycomp(native unsigned int A_0, native unsigned int A_1) il managed +{ + .vtentry 4 : 1 + // Code size 27 (0x1b) + .maxstack 2 + IL_0000: ldarg.0 + IL_0001: ldind.i4 + IL_0002: ldarg.1 + IL_0003: ldind.i4 + IL_0004: ble.un.s IL_000b + + IL_0006: ldc.i4.1 + IL_0007: br.s IL_001a + + IL_0009: br.s IL_0019 + + IL_000b: ldarg.0 + IL_000c: ldind.i4 + IL_000d: ldarg.1 + IL_000e: ldind.i4 + IL_000f: bge.un.s IL_0016 + + IL_0011: ldc.i4.m1 + IL_0012: br.s IL_001a + + IL_0014: br.s IL_0019 + + IL_0016: ldc.i4.0 + IL_0017: br.s IL_001a + + IL_0019: ldc.i4.0 + IL_001a: ret +} // end of global method 'mycomp' + +.method public static int32 main() il managed +{ + .entrypoint + .maxstack 4 + .locals (int32 V_0, + unsigned int32 V_1, + value class $MultiByte$size$32000 V_2, + int32 V_3) + IL_0000: ldc.i4 0x1f40 + IL_0005: stloc.3 + IL_0006: ldc.i4 0xf404c0 + IL_000b: stloc.1 + IL_000c: ldc.i4.0 + IL_000d: stloc.0 + IL_000e: br.s IL_0014 + + IL_0010: ldloc.0 + IL_0011: ldc.i4.1 + IL_0012: add + IL_0013: stloc.0 + IL_0014: ldloc.0 + IL_0015: ldc.i4 0x1f40 + IL_001a: bge.s IL_0034 + + IL_001c: ldloc.1 + IL_001d: ldc.i4.s 19 + IL_001f: add + IL_0020: ldc.i4.s 17 + IL_0022: mul + IL_0023: ldc.i4 0x7cf + IL_0028: rem.un + IL_0029: stloc.1 + IL_002a: ldloca.s V_2 + IL_002c: ldloc.0 + IL_002d: ldc.i4.4 + IL_002e: mul + IL_002f: add + IL_0030: ldloc.1 + IL_0031: stind.i4 + IL_0032: br.s IL_0010 + + IL_0034: ldloca.s V_2 + IL_0036: ldc.i4 0x1f40 + IL_003b: ldc.i4.4 + ldftn int32 AA::mycomp(native unsigned int A_0, native unsigned int A_1) + IL_0041: call void AA::qsort(native unsigned int,unsigned int32,unsigned int32, + method int32 *(native unsigned int, native unsigned int)) + IL_0046: ldc.i4.1 + IL_0047: stloc.0 + IL_0048: br.s IL_004e + + IL_004a: ldloc.0 + IL_004b: ldc.i4.1 + IL_004c: add + IL_004d: stloc.0 + IL_004e: ldloc.0 + IL_004f: ldc.i4 0x1f40 + IL_0054: bge.s IL_007e + + IL_0056: ldloca.s V_2 + IL_0058: ldloc.0 + IL_0059: ldc.i4.4 + IL_005a: mul + IL_005b: add + IL_005c: ldind.i4 + IL_005d: ldloca.s V_2 + IL_005f: ldloc.0 + IL_0060: ldc.i4.1 + IL_0061: sub + IL_0062: ldc.i4.4 + IL_0063: mul + IL_0064: add + IL_0065: ldind.i4 + IL_0066: bge.un.s IL_007c + + IL_0068: + ldstr "failed" + IL_0072: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_0077: ldc.i4.1 + IL_0078: br.s IL_0091 + + IL_007a: br.s IL_0090 + + IL_007c: br.s IL_004a + + IL_007e: + ldstr "passed" + + IL_0088: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_008d: ldc.i4 0x64 + IL_008e: br.s IL_0091 + + IL_0090: ldc.i4.0 + IL_0091: ret +} // end of global method 'main' +} //class AA diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/qperm.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/qperm.il new file mode 100644 index 0000000000..4cc68205e1 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/qperm.il @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ + .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true ) +} +.module 'qsort.exe' +// MVID: {D2333E3D-2CA6-4703-8D46-E41A46BDF801} +.namespace QSortTest +{ + .class private auto ansi Sorter + extends [mscorlib]System.Object + { + .method private hidebysig static void Sort(native unsigned int[] A, + native unsigned int L, native unsigned int H) il managed + { + // Code size 178 (0xb2) + .maxstack 5 + .locals (native unsigned int[] V_0, + native unsigned int V_1, + unsigned int32 V_2, + int32 V_3, + native int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: bge IL_00b1 + + IL_0007: ldc.i4.s 64 + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.0 + IL_000f: ldc.i4.0 + IL_0010: stloc.1 + IL_0011: br IL_00ac + + IL_0016: ldarg.1 + IL_0017: ldc.i4.1 + IL_0018: sub + IL_0019: stloc.2 + IL_001a: ldarg.2 + IL_001b: ldc.i4.1 + IL_001c: add + IL_001d: stloc.3 + IL_001e: ldarg.0 + IL_001f: ldarg.1 + IL_0020: ldarg.2 + IL_0021: add + IL_0022: ldc.i4.2 + IL_0023: div + IL_0024: ldelem.i + IL_0025: stloc.s V_4 + IL_0027: br.s IL_0067 + + IL_0029: br.s IL_002b + + IL_002b: ldarg.0 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: sub + IL_002f: dup + IL_0030: stloc.3 + IL_0031: ldelem.i + IL_0032: ldloc.s V_4 + IL_0034: bgt.s IL_002b + + IL_0036: br.s IL_0038 + + IL_0038: ldarg.0 + IL_0039: ldloc.2 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: dup + IL_003d: stloc.2 + IL_003e: ldelem.i + IL_003f: ldloc.s V_4 + IL_0041: blt.s IL_0038 + + IL_0043: ldloc.2 + IL_0044: ldloc.3 + IL_0045: blt.s IL_0049 + + IL_0047: br.s IL_0069 + + IL_0049: ldarg.0 + IL_004a: ldloc.2 + IL_004b: ldarg.0 + IL_004c: ldloc.2 + IL_004d: ldelem.i + IL_004e: ldarg.0 + IL_004f: ldloc.3 + conv.i + IL_0050: ldelem.i + IL_0051: xor + IL_0052: stelem.i + IL_0053: ldarg.0 + IL_0054: ldloc.3 + IL_0055: ldarg.0 + IL_0056: ldloc.2 + IL_0057: ldelem.i + IL_0058: ldarg.0 + IL_0059: ldloc.3 + conv.u4 + IL_005a: ldelem.i + conv.u4 + IL_005b: xor + IL_005c: stelem.i + IL_005d: ldarg.0 + IL_005e: ldloc.2 + IL_005f: ldarg.0 + IL_0060: ldloc.2 + IL_0061: ldelem.i + IL_0062: ldarg.0 + IL_0063: ldloc.3 + IL_0064: ldelem.i + IL_0065: xor + IL_0066: stelem.i + IL_0067: br.s IL_0029 + + IL_0069: ldarg.1 + IL_006a: ldloc.3 + IL_006b: bge.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldloc.1 + IL_006f: dup + IL_0070: ldc.i4.1 + IL_0071: add + IL_0072: stloc.1 + IL_0073: ldarg.1 + IL_0074: stelem.i + IL_0075: ldloc.0 + IL_0076: ldloc.1 + IL_0077: dup + IL_0078: ldc.i4.1 + IL_0079: add + IL_007a: stloc.1 + IL_007b: ldloc.3 + IL_007c: stelem.i + IL_007d: ldloc.3 + IL_007e: ldc.i4.1 + IL_007f: add + IL_0080: ldarg.2 + IL_0081: bge.s IL_0095 + + IL_0083: ldloc.0 + IL_0084: ldloc.1 + IL_0085: dup + IL_0086: ldc.i4.1 + IL_0087: add + IL_0088: stloc.1 + IL_0089: ldloc.3 + IL_008a: ldc.i4.1 + IL_008b: add + IL_008c: stelem.i + IL_008d: ldloc.0 + IL_008e: ldloc.1 + IL_008f: dup + IL_0090: ldc.i4.1 + IL_0091: add + IL_0092: stloc.1 + IL_0093: ldarg.2 + IL_0094: stelem.i + IL_0095: ldloc.1 + IL_0096: brtrue.s IL_009a + + IL_0098: br.s IL_00b1 + + IL_009a: ldloc.0 + IL_009b: ldloc.1 + IL_009c: ldc.i4.1 + IL_009d: sub + IL_009e: dup + IL_009f: stloc.1 + IL_00a0: ldelem.i + IL_00a1: starg.s H + IL_00a3: ldloc.0 + IL_00a4: ldloc.1 + IL_00a5: ldc.i4.1 + IL_00a6: sub + IL_00a7: dup + IL_00a8: stloc.1 + IL_00a9: ldelem.i + IL_00aa: starg.s L + IL_00ac: br IL_0016 + + IL_00b1: ret + } // end of method 'Sorter::Sort' + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 4 + .locals (native unsigned int V_0, + native unsigned int[] V_1, + native unsigned int V_2, + unsigned int32 V_3, + int32 V_4, + native unsigned int V_5) + IL_0000: ldc.i4 0x1f40 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.1 + IL_000f: ldloc.0 + IL_0010: ldc.i4 0x7cf + IL_0015: mul + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: stloc.3 + IL_0019: br.s IL_0031 + + IL_001b: ldloc.1 + IL_001c: ldloc.3 + IL_001d: ldloc.2 + IL_001e: ldc.i4.s 19 + IL_0020: add.ovf + IL_0021: ldc.i4.s 17 + IL_0023: mul.ovf + IL_0024: ldc.i4 0x7cf + IL_0029: rem + IL_002a: dup + IL_002b: stloc.2 + IL_002c: stelem.i + IL_002d: ldloc.3 + IL_002e: ldc.i4.1 + IL_002f: add + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: ldloc.0 + IL_0033: ble.s IL_001b + + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: ldloc.0 + IL_0038: call void QSortTest.Sorter::Sort(native unsigned int[], + native unsigned int, + native unsigned int) + IL_003d: ldc.i4.2 + IL_003e: stloc.s V_4 + IL_0040: br.s IL_006f + + IL_0042: ldloc.1 + IL_0043: ldloc.s V_4 + IL_0045: ldc.i4.1 + IL_0046: sub + IL_0047: ldelem.i + IL_0048: ldloc.1 + IL_0049: ldloc.s V_4 + IL_004b: ldelem.i + IL_004c: ble.s IL_0069 + + IL_004e: ldstr "Test failed at index " + IL_0053: ldloca.s V_4 + IL_0055: call instance class [mscorlib]System.String [mscorlib]System.IntPtr::ToString() + IL_005a: call class [mscorlib]System.String [mscorlib]System.String::Concat(class [mscorlib]System.String, + class [mscorlib]System.String) + IL_005f: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_0064: ldc.i4.1 + IL_0065: stloc.s V_5 + IL_0067: br.s IL_0083 + + IL_0069: ldloc.s V_4 + IL_006b: ldc.i4.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.s V_4 + IL_0071: ldloc.0 + IL_0072: ble.s IL_0042 + + IL_0074: ldstr "qsort test passed" + IL_0079: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_007e: ldc.i4 0x64 + IL_007f: stloc.s V_5 + IL_0081: br.s IL_0083 + + IL_0083: ldloc.s V_5 + IL_0085: ret + } // end of method 'Sorter::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Sorter::.ctor' + + } // end of class 'Sorter' + +} // end of namespace 'QSortTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/sizeof-ia64.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/sizeof-ia64.il new file mode 100644 index 0000000000..f02f67b288 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/sizeof-ia64.il @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'avg'// as "avg" +{ +} +.module 'avg.exe' +// MVID: {BCA6096F-DF11-4FA3-BF16-EEDA01729535} +.namespace AvgTest +{ + .class private auto ansi Test + extends [mscorlib]System.Object + { + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 48 (0x30) + .maxstack 5 + ldc.i4.8 + ldc.i4.8 + ldc.i4.8 + ldc.i4.8 + sizeof native int + ceq + brfalse pop3 + sizeof native unsigned int + ceq + brfalse pop2 + sizeof [mscorlib]System.IntPtr + ceq + brfalse pop1 + sizeof [mscorlib]System.UIntPtr + ceq + brfalse pop0 + ldc.i4 0x64 + br.s return + pop3: + pop + pop2: + pop + pop1: + pop + pop0: + ldc.i4.1 + return: + ret + } // end of method 'Test::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Test::.ctor' + + } // end of class 'Test' + +} // end of namespace 'AvgTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_conv.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_conv.il new file mode 100644 index 0000000000..827784bbe0 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_conv.il @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static native unsigned int to_native(int32) il managed +{ + ldarg.0 + conv.ovf.i + ret +} +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + .maxstack 8 + //------------------------ + // U -> I4 conversion test + //------------------------ + .try { + ldc.i4 0x7fffffff + call native unsigned int Test::to_native(int32) + conv.ovf.i4 + ldc.i4 0x7fffffff + beq OK1_1 + leave FAIL + OK1_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native unsigned int Test::to_native(int32) + conv.ovf.i4 + ldc.i4.m1 + beq OK1_2 + leave FAIL + OK1_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // U -> I2 conversion test + //------------------------ + .try { + ldc.i4 0x7fffffff + call native unsigned int Test::to_native(int32) + conv.ovf.i2 + pop + leave FAIL + } catch [mscorlib]System.Exception { + pop + leave OK + } + .try { + ldc.i4 0x7fffffff + call native unsigned int Test::to_native(int32) + conv.i2 + ldc.i4.m1 + beq OK2_1 + leave FAIL + OK2_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4 0x7fff + call native unsigned int Test::to_native(int32) + conv.ovf.i2 + ldc.i4 0x7fff + beq OK2_2 + leave FAIL + OK2_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native unsigned int Test::to_native(int32) + conv.ovf.i2 + ldc.i4.m1 + beq OK2_3 + leave FAIL + OK2_3: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native unsigned int Test::to_native(int32) + conv.ovf.i2 + ldc.i4.m1 + beq OK2_4 + leave FAIL + OK2_4: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // U -> I1 conversion test + //------------------------ + .try { + ldc.i4 0x7fff + call native unsigned int Test::to_native(int32) + conv.ovf.i1 + pop + leave FAIL + } catch [mscorlib]System.Exception { + pop + leave OK + } + .try { + ldc.i4 0x7fff + call native unsigned int Test::to_native(int32) + conv.i1 + ldc.i4.m1 + beq OK3_1 + leave FAIL + OK3_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4 0x7f + call native unsigned int Test::to_native(int32) + conv.ovf.i1 + ldc.i4 0x7f + beq OK3_2 + leave FAIL + OK3_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // U -> U4 conversion test + //------------------------ + .try { + ldc.i4 0x7fffffff + call native unsigned int Test::to_native(int32) + conv.ovf.u4.un + ldc.i4 0x7fffffff + beq OK4_1 + leave FAIL + OK4_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4.m1 + call native unsigned int Test::to_native(int32) + conv.ovf.u4 + ldc.i4.m1 + beq OK4_2 + leave FAIL + OK4_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // U -> U1 conversion test + //------------------------ + .try { + ldc.i4 0x7fff + call native unsigned int Test::to_native(int32) + conv.ovf.u1.un + pop + leave FAIL + } catch [mscorlib]System.Exception { + pop + leave OK + } + .try { + ldc.i4 0x7fff + call native unsigned int Test::to_native(int32) + conv.u1 + ldc.i4.m1 + beq OK5_1 + leave FAIL + OK5_1: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + .try { + ldc.i4 0x7f + call native unsigned int Test::to_native(int32) + conv.ovf.u1 + ldc.i4 0x7f + beq OK5_2 + leave FAIL + OK5_2: + leave OK + } catch [mscorlib]System.Exception { + pop + leave FAIL + } + //------------------------ + // U -> R4 conversion test + //------------------------ + ldc.i4 0x7fff + dup + call native unsigned int Test::to_native(int32) + conv.r4 + conv.i + ceq + brfalse FAIL + ldc.i4 -1900 + dup + call native unsigned int Test::to_native(int32) + conv.r4 + conv.i + ceq + brfalse FAIL + //------------------------ + // U -> R8 conversion test + //------------------------ + ldc.i4 0x7fff + dup + call native unsigned int Test::to_native(int32) + conv.r8 + conv.i + ceq + brfalse FAIL + ldc.i4 -1900 + dup + call native unsigned int Test::to_native(int32) + conv.r8 + conv.i + ceq + brfalse FAIL + +OK: + ldc.i4 0x64 + ldstr "passed" + br PRINT +FAIL: + ldc.i4.1 + ldstr "failed" +PRINT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_fld.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_fld.il new file mode 100644 index 0000000000..7df17e6de2 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_fld.il @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'qsort'// as "qsort" +{ } +.module 'qsort.exe' +.namespace Test +{ + .class private auto ansi AA extends [mscorlib]System.Object + { + .field public native unsigned int m_i + .field public static native unsigned int s_i + .field public native unsigned int[0...] m_ai + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + .maxstack 8 + .locals (class Test.AA pinned, native unsigned int[0...], native unsigned int, int32) + newobj instance void Test.AA::.ctor() + stloc.0 + + ldc.i4 18 + stloc.2 + + ldc.i4 19 + newobj instance void native unsigned int[0...]::.ctor(int32) + dup + dup + stloc.1 + dup + + ldc.i4 16 + ldsflda native unsigned int Test.AA::s_i + stelem.i + ldc.i4 17 + ldloc.0 + ldflda native unsigned int Test.AA::m_i + stelem.i + ldc.i4 18 + ldloca 2 + stelem.i + + ldc.i4.0 + stloc.3 + begin_init_loop: + ldloc.1 + ldloc.3 + ldloc.0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldloc.3 + ldelema [mscorlib]System.IntPtr + stelem.i + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 16 + ceq + brfalse begin_init_loop + + ldc.i4.0 + dup + stloc.3 + begin_sum_loop: + ldloc.1 + ldloc.3 + ldelem.i + ldind.i + add + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 19 + ceq + brfalse begin_sum_loop + + dup + call void [mscorlib]System.Console::WriteLine(int32) + ldc.i4 248 + beq stop + + ldc.i4.1 + ldstr "failed" + br exit + stop: + ldc.i4 0x64 + ldstr "passed" + exit: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret + } // end of method 'AA::Main' + + .method public static hidebysig specialname rtspecialname void .cctor() il managed + { + .maxstack 8 + ldc.i4 100 + stsfld native unsigned int Test.AA::s_i + ret + } // end of method 'AA::.ctor' + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + .maxstack 8 + .locals (int32) + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4 10 + stfld native unsigned int Test.AA::m_i + ldarg.0 + ldc.i4 16 + newobj instance void native unsigned int[0...]::.ctor(int32) + stfld native unsigned int[0...] Test.AA::m_ai + + ldc.i4.0 + br begin_loop + begin_loop: + dup + stloc.0 + ldarg.0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldloc.0 + dup + stelem.i + ldc.i4.1 + add + dup + ldc.i4 16 + ceq + brfalse begin_loop + end_loop: + pop + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flood.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flood.il new file mode 100644 index 0000000000..6df7795e06 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flood.il @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'avg'// as "avg" +{ +} +.module 'avg.exe' +// MVID: {BCA6096F-DF11-4FA3-BF16-EEDA01729535} +.namespace AvgTest { + .class private auto ansi Test extends [mscorlib]System.Object { + .method private hidebysig static int32 Main() il managed { + .entrypoint + .maxstack 8 + .locals(native unsigned int) + ldc.i4.0 + conv.u + stloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + ldloc.0 + br8: brtrue pop7 + br7: brfalse pop6 + br6: brfalse pop5 + br5: bge pop3 + br3: brtrue pop2 + br2: brtrue pop1 + br1: brfalse pop0 + br0: br pop0 + pop7: brtrue br6 + pop6: brfalse br5 + pop5: pop + pop4: brtrue br3 + pop3: brfalse br2 + pop2: brfalse br1 + pop1: brtrue br0 + pop0: ldc.i4 0x64 + ret + } // end of method 'Test::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Test::.ctor' + + } // end of class 'Test' + +} // end of namespace 'AvgTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flow.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flow.il new file mode 100644 index 0000000000..b3455071c3 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flow.il @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ +} +.module 'qsort.exe' +// MVID: {3433C0F8-3BEA-4168-AB0C-C275EF054928} +.namespace Test +{ + .class private auto ansi AA extends [mscorlib]System.Object + { + .field public native unsigned int m_i + .field public native unsigned int[0...] m_ai + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 8 + .locals (class Test.AA, native unsigned int i, native unsigned int& p1, native unsigned int& p2) + newobj instance void Test.AA::.ctor() + stloc.0 + + ldloc.0 + ldc.i4 0x80000000 + conv.u + stfld native unsigned int Test.AA::m_i + + ldloc.0 + ldfld native unsigned int Test.AA::m_i + ldc.i4 0x7fffffff + conv.u + blt.un fail + + ldloc.0 + ldfld native unsigned int Test.AA::m_i + ldc.i4 0x80000001 + conv.u + bgt.un fail + + ldloc.0 + ldfld native unsigned int Test.AA::m_i + ldc.i4 0x80000001 + conv.u + bgt.un fail + + ldc.i4.0 + stloc i + + again: + ldloc i + switch (a1,a2,a3,a4,a5,a6,stop) + a1: + ldloca i + br merge_1 + a2: + ldloca i + merge_2: + ldloc.0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldc.i4.1 + ldelema [mscorlib]System.IntPtr + br final_merge + a3: + ldloc.0 + ldflda native unsigned int Test.AA::m_i + merge_3: + ldloca i + br final_merge + a4: + ldloc.0 + ldflda native unsigned int Test.AA::m_i + br merge_2 + a5: + ldloc.0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldc.i4.1 + ldelema [mscorlib]System.IntPtr + br merge_3 + a6: + ldloc.0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldc.i4.1 + ldelema [mscorlib]System.IntPtr + merge_1: + ldloc.0 + ldflda native unsigned int Test.AA::m_i + final_merge: + stloc p1 + stloc p2 + ldloc p1 + ldloc p2 + beq fail + + ldloc p1 + ldind.i + dup + ldloc p2 + ldind.i + add + sub + ldloc p2 + ldind.i + ceq + brfalse fail + + ldloc i + ldc.i4.1 + add.ovf.un + stloc i + + stop: + ldc.i4 0x64 + ldstr "passed" + br exit + + fail: + ldc.i4.1 + ldstr "failed" + exit: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret + } // end of method 'AA::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4.0 + stfld native unsigned int Test.AA::m_i + ldarg.0 + ldc.i4.8 + newobj instance void native unsigned int[0...]::.ctor(int32) + stfld native unsigned int[0...] Test.AA::m_ai + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flow_merge.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flow_merge.il new file mode 100644 index 0000000000..0e74d1e5bc --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_flow_merge.il @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + .maxstack 4 + .locals (unsigned int32, native unsigned int, native unsigned int) + ldc.i4.0 + dup + stloc.0 + stloc.1 + + ldc.i4 0x12345678 + stloc.2 + + ldc.i4.0 + br.s loop_begin +loop_begin: + dup + brfalse branch1 + ldloca 0 + ldstr "branch1" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + br.s merge1 +branch1: + ldstr "branch2" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldloca 1 +merge1: + ldloca 2 + ldind.i + stind.i4 + ldc.i4.1 + add.ovf.un + dup + ldc.i4.2 + ceq + brfalse.s loop_begin + pop + + ldloc.0 + ldloc.1 + add.ovf.un + ldloca 2 + ldind.i + sub.ovf.un + ldloc.2 + sub.ovf.un + ldc.i4 0x64 + add + ret +} // end of method 'Test::Main' + +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret +} // end of method 'Test::.ctor' + +} // end of class 'Test' diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_prop.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_prop.il new file mode 100644 index 0000000000..3fd6fb7c19 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_prop.il @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'qsort'// as "qsort" +{ } +.module 'qsort.exe' +.namespace Test +{ + .class private auto ansi BB extends [mscorlib]System.Object + { + .method private hidebysig static int32 Main() il managed + { + .entrypoint + .maxstack 8 + .locals (class Test.AA) + + newobj instance void Test.AA::.ctor() + stloc.0 + ldloc.0 + ldc.i4.0 + call instance void Test.AA::set_I(native unsigned int) + ldloc.0 + call instance native unsigned int Test.AA::get_I() + ldstr "passed" + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ldc.i4 0x64 + add + ret + } // end of method 'AA::Main' + + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret + } // end of method 'AA::.ctor' + } + .class private auto ansi AA extends [mscorlib]System.Object + { + .field private native unsigned int m_i + + .method public native unsigned int get_I() il managed + { + .maxstack 8 + ldarg.0 + ldfld native unsigned int Test.AA::m_i + ret + } + + .method public void set_I(native unsigned int) il managed + { + .maxstack 8 + ldarg.0 + ldarg.1 + stfld native unsigned int Test.AA::m_i + ret + } + + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4.0 + stfld native unsigned int Test.AA::m_i + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_qsort1.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_qsort1.il new file mode 100644 index 0000000000..e2f6cd4dc2 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_qsort1.il @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ + .permission reqmin ['mscorlib']System.Security.Permissions.SecurityPermissionAttribute ( "SkipVerification" = true ) +} +.module 'qsort.exe' +// MVID: {D2333E3D-2CA6-4703-8D46-E41A46BDF801} +.namespace QSortTest +{ + .class private auto ansi Sorter + extends [mscorlib]System.Object + { + .method private hidebysig static void Sort(native unsigned int[] A, + native unsigned int L, native unsigned int H) il managed + { + // Code size 178 (0xb2) + .maxstack 5 + .locals (native unsigned int[] V_0, + native unsigned int V_1, + native unsigned int V_2, + native unsigned int V_3, + native unsigned int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: bge IL_00b1 + + IL_0007: ldc.i4.s 64 + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.0 + IL_000f: ldc.i4.0 + IL_0010: stloc.1 + IL_0011: br IL_00ac + + IL_0016: ldarg.1 + IL_0017: ldc.i4.1 + IL_0018: sub + IL_0019: stloc.2 + IL_001a: ldarg.2 + IL_001b: ldc.i4.1 + IL_001c: add + IL_001d: stloc.3 + IL_001e: ldarg.0 + IL_001f: ldarg.1 + IL_0020: ldarg.2 + IL_0021: add + IL_0022: ldc.i4.2 + IL_0023: div + IL_0024: ldelem.i + IL_0025: stloc.s V_4 + IL_0027: br.s IL_0067 + + IL_0029: br.s IL_002b + + IL_002b: ldarg.0 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: sub + IL_002f: dup + IL_0030: stloc.3 + IL_0031: ldelem.i + IL_0032: ldloc.s V_4 + IL_0034: bgt.s IL_002b + + IL_0036: br.s IL_0038 + + IL_0038: ldarg.0 + IL_0039: ldloc.2 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: dup + IL_003d: stloc.2 + IL_003e: ldelem.i + IL_003f: ldloc.s V_4 + IL_0041: blt.s IL_0038 + + IL_0043: ldloc.2 + IL_0044: ldloc.3 + IL_0045: blt.s IL_0049 + + IL_0047: br.s IL_0069 + + IL_0049: ldarg.0 + IL_004a: ldloc.2 + IL_004b: ldarg.0 + IL_004c: ldloc.2 + IL_004d: ldelem.i + IL_004e: ldarg.0 + IL_004f: ldloc.3 + IL_0050: ldelem.i + IL_0051: xor + IL_0052: stelem.i + IL_0053: ldarg.0 + IL_0054: ldloc.3 + IL_0055: ldarg.0 + IL_0056: ldloc.2 + IL_0057: ldelem.i + IL_0058: ldarg.0 + IL_0059: ldloc.3 + IL_005a: ldelem.i + IL_005b: xor + IL_005c: stelem.i + IL_005d: ldarg.0 + IL_005e: ldloc.2 + IL_005f: ldarg.0 + IL_0060: ldloc.2 + IL_0061: ldelem.i + IL_0062: ldarg.0 + IL_0063: ldloc.3 + IL_0064: ldelem.i + IL_0065: xor + IL_0066: stelem.i + IL_0067: br.s IL_0029 + + IL_0069: ldarg.1 + IL_006a: ldloc.3 + IL_006b: bge.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldloc.1 + IL_006f: dup + IL_0070: ldc.i4.1 + IL_0071: add + IL_0072: stloc.1 + IL_0073: ldarg.1 + IL_0074: stelem.i + IL_0075: ldloc.0 + IL_0076: ldloc.1 + IL_0077: dup + IL_0078: ldc.i4.1 + IL_0079: add + IL_007a: stloc.1 + IL_007b: ldloc.3 + IL_007c: stelem.i + IL_007d: ldloc.3 + IL_007e: ldc.i4.1 + IL_007f: add + IL_0080: ldarg.2 + IL_0081: bge.s IL_0095 + + IL_0083: ldloc.0 + IL_0084: ldloc.1 + IL_0085: dup + IL_0086: ldc.i4.1 + IL_0087: add + IL_0088: stloc.1 + IL_0089: ldloc.3 + IL_008a: ldc.i4.1 + IL_008b: add + IL_008c: stelem.i + IL_008d: ldloc.0 + IL_008e: ldloc.1 + IL_008f: dup + IL_0090: ldc.i4.1 + IL_0091: add + IL_0092: stloc.1 + IL_0093: ldarg.2 + IL_0094: stelem.i + IL_0095: ldloc.1 + IL_0096: brtrue.s IL_009a + + IL_0098: br.s IL_00b1 + + IL_009a: ldloc.0 + IL_009b: ldloc.1 + IL_009c: ldc.i4.1 + IL_009d: sub + IL_009e: dup + IL_009f: stloc.1 + IL_00a0: ldelem.i + IL_00a1: starg.s H + IL_00a3: ldloc.0 + IL_00a4: ldloc.1 + IL_00a5: ldc.i4.1 + IL_00a6: sub + IL_00a7: dup + IL_00a8: stloc.1 + IL_00a9: ldelem.i + IL_00aa: starg.s L + IL_00ac: br IL_0016 + + IL_00b1: ret + } // end of method 'Sorter::Sort' + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 4 + .locals (native unsigned int V_0, + native unsigned int[] V_1, + native unsigned int V_2, + native unsigned int V_3, + native unsigned int V_4, + native unsigned int V_5) + IL_0000: ldc.i4 0x1f40 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.1 + IL_000f: ldloc.0 + IL_0010: ldc.i4 0x7cf + IL_0015: mul + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: stloc.3 + IL_0019: br.s IL_0031 + + IL_001b: ldloc.1 + IL_001c: ldloc.3 + IL_001d: ldloc.2 + IL_001e: ldc.i4.s 19 + IL_0020: add.ovf + IL_0021: ldc.i4.s 17 + IL_0023: mul.ovf + IL_0024: ldc.i4 0x7cf + IL_0029: rem + IL_002a: dup + IL_002b: stloc.2 + IL_002c: stelem.i + IL_002d: ldloc.3 + IL_002e: ldc.i4.1 + IL_002f: add + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: ldloc.0 + IL_0033: ble.s IL_001b + + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: ldloc.0 + IL_0038: call void QSortTest.Sorter::Sort(native unsigned int[], + native unsigned int, + native unsigned int) + IL_003d: ldc.i4.2 + IL_003e: stloc.s V_4 + IL_0040: br.s IL_006f + + IL_0042: ldloc.1 + IL_0043: ldloc.s V_4 + IL_0045: ldc.i4.1 + IL_0046: sub + IL_0047: ldelem.i + IL_0048: ldloc.1 + IL_0049: ldloc.s V_4 + IL_004b: ldelem.i + IL_004c: ble.s IL_0069 + + IL_004e: ldstr "Test failed at index " + IL_0053: ldloca.s V_4 + IL_0055: call instance class [mscorlib]System.String [mscorlib]System.IntPtr::ToString() + IL_005a: call class [mscorlib]System.String [mscorlib]System.String::Concat(class [mscorlib]System.String, + class [mscorlib]System.String) + IL_005f: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_0064: ldc.i4.1 + IL_0065: stloc.s V_5 + IL_0067: br.s IL_0083 + + IL_0069: ldloc.s V_4 + IL_006b: ldc.i4.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.s V_4 + IL_0071: ldloc.0 + IL_0072: ble.s IL_0042 + + IL_0074: ldstr "qsort test passed" + IL_0079: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_007e: ldc.i4 0x64 + IL_007f: stloc.s V_5 + IL_0081: br.s IL_0083 + + IL_0083: ldloc.s V_5 + IL_0085: ret + } // end of method 'Sorter::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Sorter::.ctor' + + } // end of class 'Sorter' + +} // end of namespace 'QSortTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_qsort2.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_qsort2.il new file mode 100644 index 0000000000..25ec1053b6 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_qsort2.il @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'qsort'// as "qsort" +{ +} +.module 'qsort.exe' +// MVID: {D2333E3D-2CA6-4703-8D46-E41A46BDF801} +.namespace QSortTest +{ + .class private auto ansi Sorter + extends [mscorlib]System.Object + { + .method private hidebysig static void Sort(native unsigned int[] A, + native unsigned int L, native unsigned int H) il managed + { + // Code size 178 (0xb2) + .maxstack 5 + .locals (native unsigned int[] V_0, + native unsigned int V_1, + native unsigned int V_2, + native unsigned int V_3, + native unsigned int V_4) + IL_0000: ldarg.1 + IL_0001: ldarg.2 + IL_0002: bge IL_00b1 + + IL_0007: ldc.i4.s 64 + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.0 + IL_000f: ldc.i4.0 + IL_0010: stloc.1 + IL_0011: br IL_00ac + + IL_0016: ldarg.1 + IL_0017: ldc.i4.1 + IL_0018: sub + IL_0019: stloc.2 + IL_001a: ldarg.2 + IL_001b: ldc.i4.1 + IL_001c: add + IL_001d: stloc.3 + IL_001e: ldarg.0 + IL_001f: ldarg.1 + IL_0020: ldarg.2 + IL_0021: add + IL_0022: ldc.i4.2 + IL_0023: div + IL_0024: ldelem.u4 + IL_0025: stloc.s V_4 + IL_0027: br.s IL_0067 + + IL_0029: br.s IL_002b + + IL_002b: ldarg.0 + IL_002c: ldloc.3 + IL_002d: ldc.i4.1 + IL_002e: sub + IL_002f: dup + IL_0030: stloc.3 + IL_0031: ldelem.u4 + IL_0032: ldloc.s V_4 + IL_0034: bgt.s IL_002b + + IL_0036: br.s IL_0038 + + IL_0038: ldarg.0 + IL_0039: ldloc.2 + IL_003a: ldc.i4.1 + IL_003b: add + IL_003c: dup + IL_003d: stloc.2 + IL_003e: ldelem.u4 + IL_003f: ldloc.s V_4 + IL_0041: blt.s IL_0038 + + IL_0043: ldloc.2 + IL_0044: ldloc.3 + IL_0045: blt.s IL_0049 + + IL_0047: br.s IL_0069 + + IL_0049: ldarg.0 + IL_004a: ldloc.2 + IL_004b: ldarg.0 + IL_004c: ldloc.2 + IL_004d: ldelem.u4 + IL_004e: ldarg.0 + IL_004f: ldloc.3 + IL_0050: ldelem.u4 + IL_0051: xor + IL_0052: stelem.i4 + IL_0053: ldarg.0 + IL_0054: ldloc.3 + IL_0055: ldarg.0 + IL_0056: ldloc.2 + IL_0057: ldelem.u4 + IL_0058: ldarg.0 + IL_0059: ldloc.3 + IL_005a: ldelem.u4 + IL_005b: xor + IL_005c: stelem.i4 + IL_005d: ldarg.0 + IL_005e: ldloc.2 + IL_005f: ldarg.0 + IL_0060: ldloc.2 + IL_0061: ldelem.u4 + IL_0062: ldarg.0 + IL_0063: ldloc.3 + IL_0064: ldelem.u4 + IL_0065: xor + IL_0066: stelem.i4 + IL_0067: br.s IL_0029 + + IL_0069: ldarg.1 + IL_006a: ldloc.3 + IL_006b: bge.s IL_007d + + IL_006d: ldloc.0 + IL_006e: ldloc.1 + IL_006f: dup + IL_0070: ldc.i4.1 + IL_0071: add + IL_0072: stloc.1 + IL_0073: ldarg.1 + IL_0074: stelem.i4 + IL_0075: ldloc.0 + IL_0076: ldloc.1 + IL_0077: dup + IL_0078: ldc.i4.1 + IL_0079: add + IL_007a: stloc.1 + IL_007b: ldloc.3 + IL_007c: stelem.i4 + IL_007d: ldloc.3 + IL_007e: ldc.i4.1 + IL_007f: add + IL_0080: ldarg.2 + IL_0081: bge.s IL_0095 + + IL_0083: ldloc.0 + IL_0084: ldloc.1 + IL_0085: dup + IL_0086: ldc.i4.1 + IL_0087: add + IL_0088: stloc.1 + IL_0089: ldloc.3 + IL_008a: ldc.i4.1 + IL_008b: add + IL_008c: stelem.i4 + IL_008d: ldloc.0 + IL_008e: ldloc.1 + IL_008f: dup + IL_0090: ldc.i4.1 + IL_0091: add + IL_0092: stloc.1 + IL_0093: ldarg.2 + IL_0094: stelem.i4 + IL_0095: ldloc.1 + IL_0096: brtrue.s IL_009a + + IL_0098: br.s IL_00b1 + + IL_009a: ldloc.0 + IL_009b: ldloc.1 + IL_009c: ldc.i4.1 + IL_009d: sub + IL_009e: dup + IL_009f: stloc.1 + IL_00a0: ldelem.u4 + IL_00a1: starg.s H + IL_00a3: ldloc.0 + IL_00a4: ldloc.1 + IL_00a5: ldc.i4.1 + IL_00a6: sub + IL_00a7: dup + IL_00a8: stloc.1 + IL_00a9: ldelem.u4 + IL_00aa: starg.s L + IL_00ac: br IL_0016 + + IL_00b1: ret + } // end of method 'Sorter::Sort' + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 134 (0x86) + .maxstack 4 + .locals (native unsigned int V_0, + native unsigned int[] V_1, + native unsigned int V_2, + native unsigned int V_3, + native unsigned int V_4, + native unsigned int V_5) + IL_0000: ldc.i4 0x1f40 + IL_0005: stloc.0 + IL_0006: ldloc.0 + IL_0007: ldc.i4.1 + IL_0008: add + IL_0009: newarr [mscorlib]System.IntPtr + IL_000e: stloc.1 + IL_000f: ldloc.0 + IL_0010: ldc.i4 0x7cf + IL_0015: mul + IL_0016: stloc.2 + IL_0017: ldc.i4.1 + IL_0018: stloc.3 + IL_0019: br.s IL_0031 + + IL_001b: ldloc.1 + IL_001c: ldloc.3 + IL_001d: ldloc.2 + IL_001e: ldc.i4.s 19 + IL_0020: add.ovf + IL_0021: ldc.i4.s 17 + IL_0023: mul.ovf + IL_0024: ldc.i4 0x7cf + IL_0029: rem + IL_002a: dup + IL_002b: stloc.2 + IL_002c: stelem.i4 + IL_002d: ldloc.3 + IL_002e: ldc.i4.1 + IL_002f: add.ovf.un + IL_0030: stloc.3 + IL_0031: ldloc.3 + IL_0032: ldloc.0 + IL_0033: ble.s IL_001b + + IL_0035: ldloc.1 + IL_0036: ldc.i4.1 + IL_0037: ldloc.0 + IL_0038: call void QSortTest.Sorter::Sort(native unsigned int[], + native unsigned int, + native unsigned int) + IL_003d: ldc.i4.2 + IL_003e: stloc.s V_4 + IL_0040: br.s IL_006f + + IL_0042: ldloc.1 + IL_0043: ldloc.s V_4 + IL_0045: ldc.i4.1 + IL_0046: sub + IL_0047: ldelem.u4 + IL_0048: ldloc.1 + IL_0049: ldloc.s V_4 + IL_004b: ldelem.u4 + IL_004c: ble.s IL_0069 + + IL_004e: ldstr "Test failed at index " + IL_0053: ldloca.s V_4 + IL_0055: call instance class [mscorlib]System.String [mscorlib]System.IntPtr::ToString() + IL_005a: call class [mscorlib]System.String [mscorlib]System.String::Concat(class [mscorlib]System.String, + class [mscorlib]System.String) + IL_005f: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_0064: ldc.i4.1 + IL_0065: stloc.s V_5 + IL_0067: br.s IL_0083 + + IL_0069: ldloc.s V_4 + IL_006b: ldc.i4.1 + IL_006c: add + IL_006d: stloc.s V_4 + IL_006f: ldloc.s V_4 + IL_0071: ldloc.0 + IL_0072: ble.s IL_0042 + + IL_0074: ldstr "qsort test passed" + IL_0079: call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + IL_007e: ldc.i4 0x64 + IL_007f: stloc.s V_5 + IL_0081: br.s IL_0083 + + IL_0083: ldloc.s V_5 + IL_0085: ret + } // end of method 'Sorter::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Sorter::.ctor' + + } // end of class 'Sorter' + +} // end of namespace 'QSortTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_ref.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_ref.il new file mode 100644 index 0000000000..cce31db361 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_ref.il @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + + + + + + + +.assembly extern mscorlib +{ +} +.assembly 'avg'// as "avg" +{ +} +.module 'avg.exe' +// MVID: {BCA6096F-DF11-4FA3-BF16-EEDA01729535} +.namespace AvgTest +{ + .class private auto ansi Test extends [mscorlib]System.Object + { + .method private hidebysig static int32 Main() il managed + { + .entrypoint + // Code size 48 (0x30) + .maxstack 5 + .locals(native unsigned int) + ldc.i4.0 + stloc.0 + ldloca 0 + mkrefany [mscorlib]System.UIntPtr + ldc.i4.m1 + stloc.0 + refanyval [mscorlib]System.UIntPtr + ldind.i + ldc.i4.1 + add + ldc.i4 0x64 + add + ret + } // end of method 'Test::Main' + + .method public hidebysig specialname rtspecialname + instance void .ctor() il managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: ret + } // end of method 'Test::.ctor' + + } // end of class 'Test' + +} // end of namespace 'AvgTest' + +//*********** DISASSEMBLY COMPLETE *********************** diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_seq.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_seq.il new file mode 100644 index 0000000000..8f5dcab4a0 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_seq.il @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'test' +{ } +.class private auto ansi Test extends [mscorlib]System.Object +{ +.method private hidebysig static native unsigned int calc(native unsigned int, native unsigned int) il managed +{ + .maxstack 8 + .locals (native unsigned int) + ldarg.1 + stloc.0 + ldloc.0 + br again +again: + ldarg.0 + brfalse.s stop + ldarga 0 + ldind.i + ldarg.1 + switch (sum,fact) + pop + br stop +sum: + add + br.s cont +fact: + mul +cont: + ldarg.0 + ldc.i4.1 + sub + starg 0 + br again +stop: + ret +} + +.method private hidebysig static int32 Main() il managed +{ + .entrypoint + .maxstack 5 + ldc.i4.s 6 + ldc.i4.1 + call native unsigned int Test::calc(native unsigned int, native unsigned int) + ldc.i4 720 + conv.u + ceq + brfalse ERROR + ldc.i4.s 6 + ldc.i4.0 + call native unsigned int Test::calc(native unsigned int, native unsigned int) + ldc.i4 21 + conv.u + ceq + brfalse ERROR + ldc.i4 0x64 + ldstr "PASSED" + br EXIT +ERROR: + ldc.i4.1 + ldstr "FAILED" +EXIT: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret +} +.method public hidebysig specialname rtspecialname + instance void .ctor() il managed +{ + .maxstack 8 + ldarg.0 + call instance void [mscorlib]System.Object::.ctor() + ret +} +} diff --git a/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_vfld.il b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_vfld.il new file mode 100644 index 0000000000..86a881e8a8 --- /dev/null +++ b/tests/src/JIT/Methodical/ELEMENT_TYPE_IU/u_vfld.il @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +// +// +.assembly extern mscorlib +{ } +.assembly 'qsort'// as "qsort" +{ } +.module 'qsort.exe' +.namespace Test +{ + .class private value sealed auto ansi AA extends [mscorlib]System.ValueType + { + .field public native unsigned int m_i + .field public static native unsigned int s_i + .field public native unsigned int[0...] m_ai + + .method private hidebysig static int32 Main() il managed + { + .entrypoint + .maxstack 8 + .locals (value class Test.AA pinned, native unsigned int[0...], native unsigned int, int32, native unsigned int[0...] pinned) + newobj instance void Test.AA::.ctor() + stloc.0 + + ldloc.0 + ldfld native unsigned int[0...] Test.AA::m_ai + stloc 4 + + ldc.i4 18 + stloc.2 + + ldc.i4 19 + newobj instance void native unsigned int[0...]::.ctor(int32) + dup + dup + stloc.1 + dup + + ldc.i4 16 + ldsflda native unsigned int Test.AA::s_i + stelem.i + ldc.i4 17 + ldloca 0 + ldflda native unsigned int Test.AA::m_i + stelem.i + ldc.i4 18 + ldloca 2 + stelem.i + + ldc.i4.0 + stloc.3 + begin_init_loop: + ldloc.1 + ldloc.3 + ldloca 0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldloc.3 + ldelema [mscorlib]System.IntPtr + stelem.i + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 16 + ceq + brfalse begin_init_loop + + ldc.i4.0 + dup + stloc.3 + begin_sum_loop: + ldloc.1 + ldloc.3 + ldelem.i + ldind.i + add + + ldloc.3 + ldc.i4.1 + add + dup + stloc.3 + ldc.i4 19 + ceq + brfalse begin_sum_loop + + dup + call void [mscorlib]System.Console::WriteLine(int32) + ldc.i4 248 + beq stop + + ldc.i4.1 + ldstr "failed" + br exit + stop: + ldc.i4 0x64 + ldstr "passed" + exit: + call void [mscorlib]System.Console::WriteLine(class [mscorlib]System.String) + ret + } // end of method 'AA::Main' + + .method public static hidebysig specialname rtspecialname void .cctor() il managed + { + .maxstack 8 + ldc.i4 100 + stsfld native unsigned int Test.AA::s_i + ret + } // end of method 'AA::.ctor' + .method public hidebysig specialname rtspecialname instance void .ctor() il managed + { + .maxstack 8 + .locals (int32) + //ldarg.0 + //call instance void [mscorlib]System.Object::.ctor() + ldarg.0 + ldc.i4 10 + stfld native unsigned int Test.AA::m_i + ldarg.0 + ldc.i4 16 + newobj instance void native unsigned int[0...]::.ctor(int32) + stfld native unsigned int[0...] Test.AA::m_ai + + ldc.i4.0 + br begin_loop + begin_loop: + dup + stloc.0 + ldarg.0 + ldfld native unsigned int[0...] Test.AA::m_ai + ldloc.0 + dup + stelem.i + ldc.i4.1 + add + dup + ldc.i4 16 + ceq + brfalse begin_loop + end_loop: + pop + ret + } // end of method 'AA::.ctor' + + } // end of class 'AA' + +} // end of namespace 'Test' + +//*********** DISASSEMBLY COMPLETE *********************** |