Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d4d9d1d

Browse files
author
Bengu Li
committed
Add JIT CSE tests
Selected working JIT CSE test cases from old test bed before ToF for porting into CoreCLR. Related proj, config, and sln files added and updated. Passed build, buildtest, runtest. Cleaned up the source code. Verified all comments are OK. Code is re-formatted for consistent style. Copyright added. Scrub tool SSS ran on files other than those starting with Huge. Clean result. Pragma warning about parenthesis ignored. SSS chokes on huge files. Manually examined huge files. Pretty confident they are clean.
1 parent 2c6b0c4 commit d4d9d1d

30 files changed

Lines changed: 227182 additions & 0 deletions

tests/src/AllTestProjects.sln

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "misc", "JIT\jit64\gc\misc\m
101101
EndProject
102102
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "vswhidbey", "JIT\jit64\gc\regress\vswhidbey\vswhidbey.csproj", "{4F79D631-9938-4DB0-A483-8EEA0F531D51}"
103103
EndProject
104+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "opt", "opt", "{3B576AFC-FF4F-4C40-81BF-465767683FB9}"
105+
EndProject
106+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cse", "cse", "{816A193E-2D3A-4E4B-80FB-C9C322281F53}"
107+
EndProject
108+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cse", "JIT\jit64\opt\cse\cse.csproj", "{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}"
109+
EndProject
104110
Global
105111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
106112
Debug|Any CPU = Debug|Any CPU
@@ -299,6 +305,16 @@ Global
299305
{4F79D631-9938-4DB0-A483-8EEA0F531D51}.Release|Mixed Platforms.Build.0 = Release|x64
300306
{4F79D631-9938-4DB0-A483-8EEA0F531D51}.Release|x64.ActiveCfg = Release|x64
301307
{4F79D631-9938-4DB0-A483-8EEA0F531D51}.Release|x64.Build.0 = Release|x64
308+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Debug|Any CPU.ActiveCfg = Debug|x64
309+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
310+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Debug|Mixed Platforms.Build.0 = Debug|x64
311+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Debug|x64.ActiveCfg = Debug|x64
312+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Debug|x64.Build.0 = Debug|x64
313+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Release|Any CPU.ActiveCfg = Release|x64
314+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Release|Mixed Platforms.ActiveCfg = Release|x64
315+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Release|Mixed Platforms.Build.0 = Release|x64
316+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Release|x64.ActiveCfg = Release|x64
317+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78}.Release|x64.Build.0 = Release|x64
302318
EndGlobalSection
303319
GlobalSection(SolutionProperties) = preSolution
304320
HideSolutionNode = FALSE
@@ -339,10 +355,13 @@ Global
339355
{6B543CA2-10A2-4771-9F93-1733AA7A2DB8} = {1E0A9AAE-133F-4881-8DC6-571F12B96B8B}
340356
{39DD9A75-2535-4EBD-94A4-C7DF7EF12CF5} = {6B543CA2-10A2-4771-9F93-1733AA7A2DB8}
341357
{BD5A2705-2A6A-46A5-8EB1-8F4682B6B025} = {D9FFDA0F-00A2-458C-B3D3-77D0811E969E}
358+
{3B576AFC-FF4F-4C40-81BF-465767683FB9} = {D9FFDA0F-00A2-458C-B3D3-77D0811E969E}
342359
{17842328-DBEB-4209-BAE6-512FCA163DC5} = {BD5A2705-2A6A-46A5-8EB1-8F4682B6B025}
343360
{76DA480B-E2C8-4BE7-B012-3F89384C3184} = {BD5A2705-2A6A-46A5-8EB1-8F4682B6B025}
344361
{C4BADAC7-40D0-4C0B-9A4C-DEDC9F6BFB6E} = {17842328-DBEB-4209-BAE6-512FCA163DC5}
345362
{EDC4C742-D1C9-419B-A37D-3C687371F931} = {76DA480B-E2C8-4BE7-B012-3F89384C3184}
346363
{4F79D631-9938-4DB0-A483-8EEA0F531D51} = {EDC4C742-D1C9-419B-A37D-3C687371F931}
364+
{816A193E-2D3A-4E4B-80FB-C9C322281F53} = {3B576AFC-FF4F-4C40-81BF-465767683FB9}
365+
{D63841EE-5F9D-4089-A9F6-D1D04DD30B78} = {816A193E-2D3A-4E4B-80FB-C9C322281F53}
347366
EndGlobalSection
348367
EndGlobal

tests/src/JIT/jit64/opt/cse/HugeArray.cs

Lines changed: 3528 additions & 0 deletions
Large diffs are not rendered by default.

tests/src/JIT/jit64/opt/cse/HugeArray1.cs

Lines changed: 85508 additions & 0 deletions
Large diffs are not rendered by default.

tests/src/JIT/jit64/opt/cse/HugeField1.cs

Lines changed: 12283 additions & 0 deletions
Large diffs are not rendered by default.

tests/src/JIT/jit64/opt/cse/HugeField2.cs

Lines changed: 12279 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
7+
<bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" />
8+
</dependentAssembly>
9+
<dependentAssembly>
10+
<assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
11+
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
12+
</dependentAssembly>
13+
<dependentAssembly>
14+
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
15+
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
16+
</dependentAssembly>
17+
<dependentAssembly>
18+
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
19+
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
20+
</dependentAssembly>
21+
<dependentAssembly>
22+
<assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
23+
<bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" />
24+
</dependentAssembly>
25+
</assemblyBinding>
26+
</runtime>
27+
</configuration>
Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
//
4+
5+
//((a[0]+a[2])+a[1])
6+
//permutations for ((a[0]+a[2])+a[1])
7+
//((a[0]+a[2])+a[1])
8+
//(a[1]+(a[0]+a[2]))
9+
//(a[0]+a[2])
10+
//(a[2]+a[0])
11+
//a[0]
12+
//a[2]
13+
//(a[2]+a[0])
14+
//(a[0]+a[2])
15+
//a[1]
16+
//(a[0]+(a[2]+a[1]))
17+
//(a[2]+(a[0]+a[1]))
18+
//(a[2]+a[1])
19+
//(a[1]+a[2])
20+
//a[2]
21+
//a[1]
22+
//(a[1]+a[2])
23+
//(a[2]+a[1])
24+
//(a[0]+a[1])
25+
//(a[1]+a[0])
26+
//a[0]
27+
//a[1]
28+
//(a[1]+a[0])
29+
//(a[0]+a[1])
30+
//(a[1]+(a[0]+a[2]))
31+
//((a[0]+a[2])+a[1])
32+
namespace CseTest
33+
{
34+
using System;
35+
36+
public class Test_Main
37+
{
38+
static int Main()
39+
{
40+
int ret = 100;
41+
int[] a = new int[5];
42+
43+
a[0] = return_int(false, -69);
44+
a[2] = return_int(false, 15);
45+
a[1] = return_int(false, -17);
46+
47+
int v;
48+
49+
#if LOOP
50+
do {
51+
#endif
52+
v = ((a[0] + a[2]) + a[1]);
53+
if (v != -71)
54+
{
55+
Console.WriteLine("test0: for ((a[0]+a[2])+a[1]) failed actual value {0} ", v);
56+
ret = ret + 1;
57+
}
58+
#if LOOP
59+
for (int i = 0; i < 5; i++) {
60+
#endif
61+
v = (a[1] + (a[0] + a[2]));
62+
if (v != -71)
63+
{
64+
Console.WriteLine("test1: for (a[1]+(a[0]+a[2])) failed actual value {0} ", v);
65+
ret = ret + 1;
66+
}
67+
68+
v = (a[0] + a[2]);
69+
if (v != -54)
70+
{
71+
Console.WriteLine("test2: for (a[0]+a[2]) failed actual value {0} ", v);
72+
ret = ret + 1;
73+
}
74+
75+
v = (a[2] + a[0]);
76+
if (v != -54)
77+
{
78+
Console.WriteLine("test3: for (a[2]+a[0]) failed actual value {0} ", v);
79+
ret = ret + 1;
80+
}
81+
82+
v = (a[2] + a[0]);
83+
if (v != -54)
84+
{
85+
Console.WriteLine("test4: for (a[2]+a[0]) failed actual value {0} ", v);
86+
ret = ret + 1;
87+
}
88+
#if LOOP
89+
a[0] = return_int(false,-69);
90+
}
91+
#endif
92+
#if TRY
93+
try {
94+
#endif
95+
a[0] = return_int(false, -27);
96+
v = (a[0] + a[2]);
97+
if (v != -12)
98+
{
99+
Console.WriteLine("test5: for (a[0]+a[2]) failed actual value {0} ", v);
100+
ret = ret + 1;
101+
}
102+
103+
v = (a[0] + (a[2] + a[1]));
104+
if (v != -29)
105+
{
106+
Console.WriteLine("test6: for (a[0]+(a[2]+a[1])) failed actual value {0} ", v);
107+
ret = ret + 1;
108+
}
109+
110+
v = (a[2] + (a[0] + a[1]));
111+
if (v != -29)
112+
{
113+
Console.WriteLine("test7: for (a[2]+(a[0]+a[1])) failed actual value {0} ", v);
114+
ret = ret + 1;
115+
}
116+
117+
v = (a[2] + a[1]);
118+
if (v != -2)
119+
{
120+
Console.WriteLine("test8: for (a[2]+a[1]) failed actual value {0} ", v);
121+
ret = ret + 1;
122+
}
123+
124+
v = (a[1] + a[2]);
125+
if (v != -2)
126+
{
127+
Console.WriteLine("test9: for (a[1]+a[2]) failed actual value {0} ", v);
128+
ret = ret + 1;
129+
}
130+
#if TRY
131+
} finally {
132+
#endif
133+
134+
#if LOOP
135+
for (int j = 0; j < 5; j++) {
136+
for (int i = 0; i < 10; i++) {
137+
#endif
138+
v = (a[1] + a[2]);
139+
140+
if (v != -2)
141+
{
142+
Console.WriteLine(a[1] + " " + a[2]);
143+
Console.WriteLine("test10: for (a[1]+a[2]) failed actual value {0} ", v);
144+
ret = ret + 1;
145+
}
146+
147+
v = (a[2] + a[1]);
148+
if (v != -2)
149+
{
150+
Console.WriteLine("test11: for (a[2]+a[1]) failed actual value {0} ", v);
151+
ret = ret + 1;
152+
}
153+
154+
a[2] = return_int(false, -105);
155+
v = (a[0] + a[1]);
156+
if (v != -44)
157+
{
158+
Console.WriteLine("test12: for (a[0]+a[1]) failed actual value {0} ", v);
159+
ret = ret + 1;
160+
}
161+
162+
v = (a[1] + a[0]);
163+
if (v != -44)
164+
{
165+
Console.WriteLine("test13: for (a[1]+a[0]) failed actual value {0} ", v);
166+
ret = ret + 1;
167+
}
168+
#if LOOP
169+
a[2] = return_int(false, 15);
170+
}
171+
a[1] = return_int(false, -17);
172+
}
173+
#endif
174+
a[2] = return_int(false, -105);
175+
176+
v = (a[1] + a[0]);
177+
if (v != -44)
178+
{
179+
Console.WriteLine("test14: for (a[1]+a[0]) failed actual value {0} ", v);
180+
ret = ret + 1;
181+
}
182+
#if TRY
183+
}
184+
#endif
185+
v = (a[0] + a[1]);
186+
if (v != -44)
187+
{
188+
Console.WriteLine("test15: for (a[0]+a[1]) failed actual value {0} ", v);
189+
ret = ret + 1;
190+
}
191+
192+
v = (a[1] + (a[0] + a[2]));
193+
if (v != -149)
194+
{
195+
Console.WriteLine("test16: for (a[1]+(a[0]+a[2])) failed actual value {0} ", v);
196+
ret = ret + 1;
197+
}
198+
199+
v = ((a[0] + a[2]) + a[1]);
200+
if (v != -149)
201+
{
202+
Console.WriteLine("test17: for ((a[0]+a[2])+a[1]) failed actual value {0} ", v);
203+
ret = ret + 1;
204+
}
205+
#if LOOP
206+
} while (v==0);
207+
#endif
208+
Console.WriteLine(ret);
209+
return ret;
210+
}
211+
private static int return_int(bool verbose, int input)
212+
{
213+
int ans;
214+
215+
try
216+
{
217+
ans = input;
218+
}
219+
finally
220+
{
221+
if (verbose)
222+
{
223+
Console.WriteLine("returning : ans");
224+
}
225+
}
226+
return ans;
227+
}
228+
}
229+
}
230+

0 commit comments

Comments
 (0)