-
Notifications
You must be signed in to change notification settings - Fork 79
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
53 changed files
with
392 additions
and
103 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
20 changes: 20 additions & 0 deletions
20
Source/Mosa.Compiler.ARM32/Stages/FloatingTweakTransform.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,20 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using Mosa.Compiler.ARM32.Transforms.FloatingTweaks; | ||
|
||
namespace Mosa.Compiler.ARM32.Stages; | ||
|
||
/// <summary> | ||
/// ARM32 IR Transformation Stage | ||
/// </summary> | ||
/// <seealso cref="Mosa.Compiler.Framework.Stages.BaseTransformStage" /> | ||
public sealed class FloatingTweakTransform : Compiler.Framework.Stages.BaseTransformStage | ||
{ | ||
public override string Name => "ARM32." + GetType().Name; | ||
|
||
public FloatingTweakTransform() | ||
: base() | ||
{ | ||
AddTranforms(FloatingTweakTransforms.List); | ||
} | ||
} |
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
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
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
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
37 changes: 37 additions & 0 deletions
37
Source/Mosa.Compiler.ARM32/Transforms/FloatingTweaks/ConvertI64ToR4.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,37 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using Mosa.Compiler.Framework; | ||
|
||
namespace Mosa.Compiler.ARM32.Transforms.FloatingTweaks; | ||
|
||
/// <summary> | ||
/// ConvertI3ConvertI64ToR42ToR4 | ||
/// </summary> | ||
public sealed class ConvertI64ToR4 : BaseTransform | ||
{ | ||
public ConvertI64ToR4() : base(IR.ConvertI64ToR4, TransformType.Manual | TransformType.Transform) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
var operand1 = context.Operand1; | ||
|
||
transform.SplitOperand(operand1, out _, out _); | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
var v2 = transform.VirtualRegisters.AllocateR8(); | ||
|
||
var multiply = Operand.CreateConstant((float)uint.MaxValue); | ||
|
||
context.SetInstruction(IR.GetHigh32, v1, operand1); | ||
context.AppendInstruction(IR.ConvertI32ToR4, v2, v1); | ||
context.AppendInstruction(IR.MulR4, result, v2, multiply); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Source/Mosa.Compiler.ARM32/Transforms/FloatingTweaks/ConvertI64ToR8.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,37 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using Mosa.Compiler.Framework; | ||
|
||
namespace Mosa.Compiler.ARM32.Transforms.FloatingTweaks; | ||
|
||
/// <summary> | ||
/// ConvertI64ToR8 | ||
/// </summary> | ||
public sealed class ConvertI64ToR8 : BaseTransform | ||
{ | ||
public ConvertI64ToR8() : base(IR.ConvertI64ToR8, TransformType.Manual | TransformType.Transform) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
var operand1 = context.Operand1; | ||
|
||
transform.SplitOperand(operand1, out _, out _); | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
var v2 = transform.VirtualRegisters.AllocateR8(); | ||
|
||
var multiply = Operand.CreateConstant((double)uint.MaxValue); | ||
|
||
context.SetInstruction(IR.GetHigh32, v1, operand1); | ||
context.AppendInstruction(IR.ConvertI32ToR8, v2, v1); | ||
context.AppendInstruction(IR.MulR8, result, v2, multiply); | ||
} | ||
} |
Oops, something went wrong.