[llvm-commits] [llvm] r41318 - /llvm/trunk/lib/Target/PowerPC/README.txt

Chris Lattner sabre at nondot.org
Thu Aug 23 08:16:04 PDT 2007


Author: lattner
Date: Thu Aug 23 10:16:03 2007
New Revision: 41318

URL: http://llvm.org/viewvc/llvm-project?rev=41318&view=rev
Log:
new example

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

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

==============================================================================
--- llvm/trunk/lib/Target/PowerPC/README.txt (original)
+++ llvm/trunk/lib/Target/PowerPC/README.txt Thu Aug 23 10:16:03 2007
@@ -117,6 +117,23 @@
 Note that this (and the static variable version) is discussed here for GCC:
 http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00133.html
 
+Here's another example (the sgn function):
+double testf(double a) {
+       return a == 0.0 ? 0.0 : (a > 0.0 ? 1.0 : -1.0);
+}
+
+it produces a BB like this:
+LBB1_1: ; cond_true
+        lis r2, ha16(LCPI1_0)
+        lfs f0, lo16(LCPI1_0)(r2)
+        lis r2, ha16(LCPI1_1)
+        lis r3, ha16(LCPI1_2)
+        lfs f2, lo16(LCPI1_2)(r3)
+        lfs f3, lo16(LCPI1_1)(r2)
+        fsub f0, f0, f1
+        fsel f1, f0, f2, f3
+        blr 
+
 ===-------------------------------------------------------------------------===
 
 PIC Code Gen IPO optimization:





More information about the llvm-commits mailing list