From 15bdc96c5b5473691b653e63ffea47a7c7b2c8c1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 12 Oct 2006 22:01:26 +0000 Subject: [PATCH] add a note git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30921 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/README.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 3ee32cce055..84e1532284c 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -734,3 +734,30 @@ _foo: ret //===---------------------------------------------------------------------===// + +Consider the expansion of: + +uint %test3(uint %X) { + %tmp1 = rem uint %X, 255 + ret uint %tmp1 +} + +Currently it compiles to: + +... + movl $2155905153, %ecx + movl 8(%esp), %esi + movl %esi, %eax + mull %ecx +... + +This could be "reassociated" into: + + movl $2155905153, %eax + movl 8(%esp), %ecx + mull %ecx + +to avoid the copy. In fact, the existing two-address stuff would do this +except that mul isn't a commutative 2-addr instruction. I guess this has +to be done at isel time based on the #uses to mul? + -- 2.34.1