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.
- Loading branch information
Showing
7 changed files
with
69 additions
and
4 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
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
54 changes: 54 additions & 0 deletions
54
...mpiler.Framework/Transforms/Optimizations/Auto/StrengthReduction/ArithShiftRight64By32.cs
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,54 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
namespace Mosa.Compiler.Framework.Transforms.Optimizations.Auto.StrengthReduction; | ||
|
||
/// <summary> | ||
/// ArithShiftRight64By32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.StrengthReduction")] | ||
public sealed class ArithShiftRight64By32 : BaseTransform | ||
{ | ||
public ArithShiftRight64By32() : base(IRInstruction.GetLow32, TransformType.Auto | TransformType.Optimization, true) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, TransformContext transform) | ||
{ | ||
if (!context.Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand1.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Instruction != IRInstruction.ArithShiftRight64) | ||
return false; | ||
|
||
if (!context.Operand1.Definitions[0].Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand1.Definitions[0].Operand2.IsResolvedConstant) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Operand2.ConstantUnsigned64 != 32) | ||
return false; | ||
|
||
if (!context.Operand1.Definitions[0].Operand1.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Operand1.Definitions[0].Instruction != IRInstruction.To64) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, TransformContext transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1.Definitions[0].Operand1.Definitions[0].Operand2; | ||
|
||
context.SetInstruction(IRInstruction.Move32, result, t1); | ||
} | ||
} |
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