move PR5945 here.
authorChris Lattner <sabre@nondot.org>
Sun, 24 Jan 2010 02:27:03 +0000 (02:27 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 24 Jan 2010 02:27:03 +0000 (02:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94350 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/README.txt

index 5af108ac683b8c85d2e7c7cb632993162100f4aa..8f265cfc488b019a683e4191814ecdca1e821bd1 100644 (file)
@@ -430,6 +430,35 @@ This theoretically may help improve twolf slightly (used in dimbox.c:142?).
 
 ===-------------------------------------------------------------------------===
 
+PR5945: This: 
+define i32 @clamp0g(i32 %a) {
+entry:
+        %cmp = icmp slt i32 %a, 0
+        %sel = select i1 %cmp, i32 0, i32 %a
+        ret i32 %sel
+}
+
+Is compile to this with the PowerPC (32-bit) backend:
+
+_clamp0g:
+        cmpwi cr0, r3, 0
+        li r2, 0
+        blt cr0, LBB1_2
+; BB#1:                                                     ; %entry
+        mr r2, r3
+LBB1_2:                                                     ; %entry
+        mr r3, r2
+        blr
+
+This could be reduced to the much simpler:
+
+_clamp0g:
+        srawi r2, r3, 31
+        andc r3, r3, r2
+        blr
+
+===-------------------------------------------------------------------------===
+
 int foo(int N, int ***W, int **TK, int X) {
   int t, i;