aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/CodeGen/X86/CodeGenCommon.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-03-09 19:29:34 -0300
committerGitHub <noreply@github.com>2020-03-10 09:29:34 +1100
commit61d79facd1740264dadb6c62a0af21179bf6672b (patch)
tree4e5769fb13b3dea1be5b5977c7fdad3a9d8db01f /ARMeilleure/CodeGen/X86/CodeGenCommon.cs
parente2bb5e8091125ec626fca0f1f7213463b68b54e6 (diff)
Optimize x64 loads and stores using complex addressing modes (#972)
* Optimize x64 loads and stores using complex addressing modes * This was meant to be used for testing
Diffstat (limited to 'ARMeilleure/CodeGen/X86/CodeGenCommon.cs')
-rw-r--r--ARMeilleure/CodeGen/X86/CodeGenCommon.cs19
1 files changed, 19 insertions, 0 deletions
diff --git a/ARMeilleure/CodeGen/X86/CodeGenCommon.cs b/ARMeilleure/CodeGen/X86/CodeGenCommon.cs
new file mode 100644
index 00000000..237ecee4
--- /dev/null
+++ b/ARMeilleure/CodeGen/X86/CodeGenCommon.cs
@@ -0,0 +1,19 @@
+using ARMeilleure.IntermediateRepresentation;
+
+namespace ARMeilleure.CodeGen.X86
+{
+ static class CodeGenCommon
+ {
+ public static bool IsLongConst(Operand op)
+ {
+ long value = op.Type == OperandType.I32 ? op.AsInt32() : op.AsInt64();
+
+ return !ConstFitsOnS32(value);
+ }
+
+ private static bool ConstFitsOnS32(long value)
+ {
+ return value == (int)value;
+ }
+ }
+}