add a note
authorChris Lattner <sabre@nondot.org>
Wed, 5 Dec 2007 23:05:06 +0000 (23:05 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 5 Dec 2007 23:05:06 +0000 (23:05 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44638 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/README.txt

index 2db7e64874b99de6f6f671c0812fe1d94b673577..008271ee9fc06b62b1a648624bf2a89016d09059 100644 (file)
@@ -463,5 +463,42 @@ entry:
         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.
+
+//===---------------------------------------------------------------------===//