summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-05-30 07:37:37 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-05-30 07:37:37 +0000
commit5a622f2e06e6f579c11875bb895328e71e286636 (patch)
tree3b3015f6e723948e52664d56ed7123b01914ba2d /lib
parente6ad27e9173e15e4954d96ef3b1e8efa6c032d87 (diff)
downloadllvm-5a622f2e06e6f579c11875bb895328e71e286636.tar.gz
llvm-5a622f2e06e6f579c11875bb895328e71e286636.tar.bz2
llvm-5a622f2e06e6f579c11875bb895328e71e286636.tar.xz
Add a note about integer multiplication by constants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28551 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/X86/README.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt
index d944cbf103..590a6dbeba 100644
--- a/lib/Target/X86/README.txt
+++ b/lib/Target/X86/README.txt
@@ -622,3 +622,30 @@ How about implementing truncate / anyext as a property of machine instruction
operand? i.e. Print as 32-bit super-class register / 16-bit sub-class register.
Do this for the cases where a truncate / anyext is guaranteed to be eliminated.
For IA32 that is truncate from 32 to 16 and anyext from 16 to 32.
+
+//===---------------------------------------------------------------------===//
+
+For this:
+
+int test(int a)
+{
+ return a * 3;
+}
+
+We currently emits
+ imull $3, 4(%esp), %eax
+
+Perhaps this is what we really should generate is? Is imull three or four
+cycles? Note: ICC generates this:
+ movl 4(%esp), %eax
+ leal (%eax,%eax,2), %eax
+
+The current instruction priority is based on pattern complexity. The former is
+more "complex" because it folds a load so the latter will not be emitted.
+
+Perhaps we should use AddedComplexity to give LEA32r a higher priority? We
+should always try to match LEA first since the LEA matching code does some
+estimate to determine whether the match is profitable.
+
+However, if we care more about code size, then imull is better. It's two bytes
+shorter than movl + leal.