This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JIT CSE (common sub-expression elimination) optimization tests. Related proj, config, and sln files added and updated. Passed build, buildtest, runtest. Code went through Microsoft internal process to meet open-source requirements.
- Loading branch information
Bengu Li
committed
Apr 18, 2015
1 parent
2c6b0c4
commit 776cfa1
Showing
30 changed files
with
227,182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,230 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
// | ||
|
||
//((a[0]+a[2])+a[1]) | ||
//permutations for ((a[0]+a[2])+a[1]) | ||
//((a[0]+a[2])+a[1]) | ||
//(a[1]+(a[0]+a[2])) | ||
//(a[0]+a[2]) | ||
//(a[2]+a[0]) | ||
//a[0] | ||
//a[2] | ||
//(a[2]+a[0]) | ||
//(a[0]+a[2]) | ||
//a[1] | ||
//(a[0]+(a[2]+a[1])) | ||
//(a[2]+(a[0]+a[1])) | ||
//(a[2]+a[1]) | ||
//(a[1]+a[2]) | ||
//a[2] | ||
//a[1] | ||
//(a[1]+a[2]) | ||
//(a[2]+a[1]) | ||
//(a[0]+a[1]) | ||
//(a[1]+a[0]) | ||
//a[0] | ||
//a[1] | ||
//(a[1]+a[0]) | ||
//(a[0]+a[1]) | ||
//(a[1]+(a[0]+a[2])) | ||
//((a[0]+a[2])+a[1]) | ||
namespace CseTest | ||
{ | ||
using System; | ||
|
||
public class Test_Main | ||
{ | ||
static int Main() | ||
{ | ||
int ret = 100; | ||
int[] a = new int[5]; | ||
|
||
a[0] = return_int(false, -69); | ||
a[2] = return_int(false, 15); | ||
a[1] = return_int(false, -17); | ||
|
||
int v; | ||
|
||
#if LOOP | ||
do { | ||
#endif | ||
v = ((a[0] + a[2]) + a[1]); | ||
if (v != -71) | ||
{ | ||
Console.WriteLine("test0: for ((a[0]+a[2])+a[1]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
#if LOOP | ||
for (int i = 0; i < 5; i++) { | ||
#endif | ||
v = (a[1] + (a[0] + a[2])); | ||
if (v != -71) | ||
{ | ||
Console.WriteLine("test1: for (a[1]+(a[0]+a[2])) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[0] + a[2]); | ||
if (v != -54) | ||
{ | ||
Console.WriteLine("test2: for (a[0]+a[2]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[2] + a[0]); | ||
if (v != -54) | ||
{ | ||
Console.WriteLine("test3: for (a[2]+a[0]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[2] + a[0]); | ||
if (v != -54) | ||
{ | ||
Console.WriteLine("test4: for (a[2]+a[0]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
#if LOOP | ||
a[0] = return_int(false,-69); | ||
} | ||
#endif | ||
#if TRY | ||
try { | ||
#endif | ||
a[0] = return_int(false, -27); | ||
v = (a[0] + a[2]); | ||
if (v != -12) | ||
{ | ||
Console.WriteLine("test5: for (a[0]+a[2]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[0] + (a[2] + a[1])); | ||
if (v != -29) | ||
{ | ||
Console.WriteLine("test6: for (a[0]+(a[2]+a[1])) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[2] + (a[0] + a[1])); | ||
if (v != -29) | ||
{ | ||
Console.WriteLine("test7: for (a[2]+(a[0]+a[1])) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[2] + a[1]); | ||
if (v != -2) | ||
{ | ||
Console.WriteLine("test8: for (a[2]+a[1]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[1] + a[2]); | ||
if (v != -2) | ||
{ | ||
Console.WriteLine("test9: for (a[1]+a[2]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
#if TRY | ||
} finally { | ||
#endif | ||
|
||
#if LOOP | ||
for (int j = 0; j < 5; j++) { | ||
for (int i = 0; i < 10; i++) { | ||
#endif | ||
v = (a[1] + a[2]); | ||
|
||
if (v != -2) | ||
{ | ||
Console.WriteLine(a[1] + " " + a[2]); | ||
Console.WriteLine("test10: for (a[1]+a[2]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[2] + a[1]); | ||
if (v != -2) | ||
{ | ||
Console.WriteLine("test11: for (a[2]+a[1]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
a[2] = return_int(false, -105); | ||
v = (a[0] + a[1]); | ||
if (v != -44) | ||
{ | ||
Console.WriteLine("test12: for (a[0]+a[1]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[1] + a[0]); | ||
if (v != -44) | ||
{ | ||
Console.WriteLine("test13: for (a[1]+a[0]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
#if LOOP | ||
a[2] = return_int(false, 15); | ||
} | ||
a[1] = return_int(false, -17); | ||
} | ||
#endif | ||
a[2] = return_int(false, -105); | ||
|
||
v = (a[1] + a[0]); | ||
if (v != -44) | ||
{ | ||
Console.WriteLine("test14: for (a[1]+a[0]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
#if TRY | ||
} | ||
#endif | ||
v = (a[0] + a[1]); | ||
if (v != -44) | ||
{ | ||
Console.WriteLine("test15: for (a[0]+a[1]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = (a[1] + (a[0] + a[2])); | ||
if (v != -149) | ||
{ | ||
Console.WriteLine("test16: for (a[1]+(a[0]+a[2])) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
|
||
v = ((a[0] + a[2]) + a[1]); | ||
if (v != -149) | ||
{ | ||
Console.WriteLine("test17: for ((a[0]+a[2])+a[1]) failed actual value {0} ", v); | ||
ret = ret + 1; | ||
} | ||
#if LOOP | ||
} while (v==0); | ||
#endif | ||
Console.WriteLine(ret); | ||
return ret; | ||
} | ||
private static int return_int(bool verbose, int input) | ||
{ | ||
int ans; | ||
|
||
try | ||
{ | ||
ans = input; | ||
} | ||
finally | ||
{ | ||
if (verbose) | ||
{ | ||
Console.WriteLine("returning : ans"); | ||
} | ||
} | ||
return ans; | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.