forked from mosa/MOSA-Project
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Implement mosa#1142 (Phi improvement)
- Loading branch information
Showing
4 changed files
with
100 additions
and
1 deletion.
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
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
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,47 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
namespace Mosa.UnitTests.Optimization; | ||
|
||
public static class LoopTests | ||
{ | ||
private static uint[] array = { 1, 2, 3, 4 }; | ||
|
||
[MosaUnitTest] | ||
public static uint Loop0() | ||
{ | ||
var x = 0u; | ||
|
||
for (uint i = 0; i < 4; i++) | ||
{ | ||
x += 2; | ||
} | ||
|
||
return x; | ||
} | ||
|
||
[MosaUnitTest] | ||
public static uint Loop1() | ||
{ | ||
var x = 0u; | ||
|
||
for (uint i = 0; i < 4; i++) | ||
{ | ||
x += i * 4 + 4; | ||
} | ||
|
||
return x; | ||
} | ||
|
||
[MosaUnitTest] | ||
public static uint Loop2() | ||
{ | ||
var x = 0u; | ||
|
||
for (uint i = 0; i < 4; i++) | ||
{ | ||
x += array[i]; | ||
} | ||
|
||
return x; | ||
} | ||
} |
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