Author: lattner
Date: Wed Dec  5 17:05:06 2007
New Revision: 44638

URL: http://llvm.org/viewvc/llvm-project?rev=44638&view=rev
Log:
add a note

Modified:
    llvm/trunk/lib/Target/README.txt

Modified: llvm/trunk/lib/Target/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=44638&r1=44637&r2=44638&view=diff

==============================================================================
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Wed Dec  5 17:05:06 2007
@@ -463,5 +463,42 @@
         ret int %tmp3
 }
 
+//===---------------------------------------------------------------------===//
+on this code:
 
+unsigned array[4];
+unsigned foo(unsigned long x) {
+          return array[(x>>2)&3ul];
+}
+
+we should dag combine the left+right shift together.  We currently get:
+
+_foo:
+        movl    4(%esp), %eax
+        shrl    $2, %eax
+        andl    $3, %eax
+        movl    _array(,%eax,4), %eax
+        ret
+
+similar on ppc:
+
+_foo:
+        lis r2, ha16(_array)
+        srwi r3, r3, 2
+        la r2, lo16(_array)(r2)
+        rlwinm r3, r3, 2, 28, 29
+        lwzx r3, r2, r3
+        blr 
+
+similar on arm:
+
+_foo:
+        mov r3, #3
+        and r3, r3, r0, lsr #2
+        ldr r2, LCPI1_0
+        ldr r0, [r2, +r3, lsl #2]
+        bx lr
+
+this is a trivial dag combine xform.
 
+//===---------------------------------------------------------------------===//


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to