[llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt

Chris Lattner lattner at cs.uiuc.edu
Wed Aug 24 11:15:35 PDT 2005



Changes in directory llvm/lib/Target/PowerPC:

README.txt updated: 1.29 -> 1.30
---
Log message:

add an idea


---
Diffs of the changes:  (+30 -0)

 README.txt |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)


Index: llvm/lib/Target/PowerPC/README.txt
diff -u llvm/lib/Target/PowerPC/README.txt:1.29 llvm/lib/Target/PowerPC/README.txt:1.30
--- llvm/lib/Target/PowerPC/README.txt:1.29	Tue Aug 23 01:27:59 2005
+++ llvm/lib/Target/PowerPC/README.txt	Wed Aug 24 13:15:24 2005
@@ -52,6 +52,8 @@
 	b .LBBl42__2E_expand_function_8_42	; NewDefault
 	b .LBBl42__2E_expand_function_8_42	; NewDefault
 
+===-------------------------------------------------------------------------===
+
 * Codegen this:
 
    void test2(int X) {
@@ -71,3 +73,31 @@
         cmpw cr0, r3, r2  
         bne .LBB_test2_2
 
+===-------------------------------------------------------------------------===
+
+Lump the constant pool for each function into ONE pic object, and reference
+pieces of it as offsets from the start.  For functions like this (contrived
+to have lots of constants obviously):
+
+double X(double Y) { return (Y*1.23 + 4.512)*2.34 + 14.38; }
+
+We generate:
+
+_X:
+        lis r2, ha16(.CPI_X_0)
+        lfd f0, lo16(.CPI_X_0)(r2)
+        lis r2, ha16(.CPI_X_1)
+        lfd f2, lo16(.CPI_X_1)(r2)
+        fmadd f0, f1, f0, f2
+        lis r2, ha16(.CPI_X_2)
+        lfd f1, lo16(.CPI_X_2)(r2)
+        lis r2, ha16(.CPI_X_3)
+        lfd f2, lo16(.CPI_X_3)(r2)
+        fmadd f1, f0, f1, f2
+        blr
+
+It would be better to materialize .CPI_X into a register, then use immediates
+off of the register to avoid the lis's.  This is even more important in PIC 
+mode.
+
+===-------------------------------------------------------------------------===






More information about the llvm-commits mailing list