aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/CodeGen/Optimizations
diff options
context:
space:
mode:
authorFicture Seven <FICTURE7@gmail.com>2020-07-11 05:00:41 +0400
committerGitHub <noreply@github.com>2020-07-11 11:00:41 +1000
commit0195d0938d7582d8b4155482e4eef60406ba5ed8 (patch)
tree7cb94b390a66454e661b34b4608b3b4b6d878a22 /ARMeilleure/CodeGen/Optimizations
parent7639bb2e863fdd24876b7ef0993fcdc3bbda10a2 (diff)
Fold ZeroExtend8/16/32 imm32/64 (#1358)
* Fold ZeroExtend8/16/32 imm32/64 * Increment PTC version
Diffstat (limited to 'ARMeilleure/CodeGen/Optimizations')
-rw-r--r--ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs b/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs
index 359af113..19cc009c 100644
--- a/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs
+++ b/ARMeilleure/CodeGen/Optimizations/ConstantFolding.cs
@@ -206,6 +206,39 @@ namespace ARMeilleure.CodeGen.Optimizations
}
break;
+ case Instruction.ZeroExtend16:
+ if (type == OperandType.I32)
+ {
+ EvaluateUnaryI32(operation, (x) => (ushort)x);
+ }
+ else if (type == OperandType.I64)
+ {
+ EvaluateUnaryI64(operation, (x) => (ushort)x);
+ }
+ break;
+
+ case Instruction.ZeroExtend32:
+ if (type == OperandType.I32)
+ {
+ EvaluateUnaryI32(operation, (x) => x);
+ }
+ else if (type == OperandType.I64)
+ {
+ EvaluateUnaryI64(operation, (x) => (uint)x);
+ }
+ break;
+
+ case Instruction.ZeroExtend8:
+ if (type == OperandType.I32)
+ {
+ EvaluateUnaryI32(operation, (x) => (byte)x);
+ }
+ else if (type == OperandType.I64)
+ {
+ EvaluateUnaryI64(operation, (x) => (byte)x);
+ }
+ break;
+
case Instruction.Subtract:
if (type == OperandType.I32)
{