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

Chris Lattner sabre at nondot.org
Sat Sep 16 16:58:07 PDT 2006



Changes in directory llvm/lib/Target:

README.txt updated: 1.37 -> 1.38
---
Log message:

add a note noticed through source inspection


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

 README.txt |   33 ++++++++++++++++++++++++++++++---
 1 files changed, 30 insertions(+), 3 deletions(-)


Index: llvm/lib/Target/README.txt
diff -u llvm/lib/Target/README.txt:1.37 llvm/lib/Target/README.txt:1.38
--- llvm/lib/Target/README.txt:1.37	Fri Sep 15 15:31:36 2006
+++ llvm/lib/Target/README.txt	Sat Sep 16 18:57:51 2006
@@ -198,11 +198,11 @@
         %struct.Y = type { %struct.X }
 ulong %bar() {
         %retval = alloca %struct.Y, align 8             ; <%struct.Y*> [#uses=3]
-        %tmp12 = getelementptr %struct.Y* %retval, int 0, uint 0, uint 0                ; <int*> [#uses=1]
+        %tmp12 = getelementptr %struct.Y* %retval, int 0, uint 0, uint 0
         store int 0, int* %tmp12
-        %tmp15 = getelementptr %struct.Y* %retval, int 0, uint 0, uint 1                ; <int*> [#uses=1]
+        %tmp15 = getelementptr %struct.Y* %retval, int 0, uint 0, uint 1
         store int 1, int* %tmp15
-        %retval = cast %struct.Y* %retval to ulong*             ; <ulong*> [#uses=1]
+        %retval = cast %struct.Y* %retval to ulong*
         %retval = load ulong* %retval           ; <ulong> [#uses=1]
         ret ulong %retval
 }
@@ -247,3 +247,30 @@
 
 on targets that have popcnt but not ctlz.  itanium, what else?
 
+//===---------------------------------------------------------------------===//
+
+quantum_sigma_x in 462.libquantum contains the following loop:
+
+      for(i=0; i<reg->size; i++)
+	{
+	  /* Flip the target bit of each basis state */
+	  reg->node[i].state ^= ((MAX_UNSIGNED) 1 << target);
+	} 
+
+Where MAX_UNSIGNED/state is a 64-bit int.  On a 32-bit platform it would be just
+so cool to turn it into something like:
+
+   if (target < 32) {
+     for(i=0; i<reg->size; i++)
+       reg->node[i].state ^= ((int) (1 << target));
+   } else {
+     for(i=0; i<reg->size; i++)
+       reg->node[i].state ^= (long long)((int) (1 << (target-32))) << 32;
+   }
+   
+... which would only do one 32-bit XOR per loop iteration instead of two.
+
+It would also be nice to recognize the reg->size doesn't alias reg->node[i], but
+alas...
+
+//===---------------------------------------------------------------------===//






More information about the llvm-commits mailing list