add a note
authorChris Lattner <sabre@nondot.org>
Thu, 14 Sep 2006 20:56:30 +0000 (20:56 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 14 Sep 2006 20:56:30 +0000 (20:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30377 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/README.txt

index 2c99e02e4e22f5277ff96e9dce4c574f82feb5f4..b0840a5e501a1022af0422cc517c29bdfbc21593 100644 (file)
@@ -539,3 +539,28 @@ be folded together.
 unsigned short G;
 void foo(unsigned long H) { G = H; }
 
+===-------------------------------------------------------------------------===
+
+We compile:
+
+unsigned test6(unsigned x) { 
+  return ((x & 0x00FF0000) >> 16) | ((x & 0x000000FF) << 16);
+}
+
+into:
+
+_test6:
+        lis r2, 255
+        rlwinm r3, r3, 16, 0, 31
+        ori r2, r2, 255
+        and r3, r3, r2
+        blr
+
+GCC gets it down to:
+
+_test6:
+        rlwinm r0,r3,16,8,15
+        rlwinm r3,r3,16,24,31
+        or r3,r3,r0
+        blr
+