[llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/xor.ll

Chris Lattner lattner at cs.uiuc.edu
Sun Feb 15 21:54:01 PST 2004


Changes in directory llvm/test/Regression/Transforms/InstCombine:

xor.ll updated: 1.11 -> 1.12

---
Log message:

Add a test for the "swap idiom", which LLVM should be able to unravel.


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

Index: llvm/test/Regression/Transforms/InstCombine/xor.ll
diff -u llvm/test/Regression/Transforms/InstCombine/xor.ll:1.11 llvm/test/Regression/Transforms/InstCombine/xor.ll:1.12
--- llvm/test/Regression/Transforms/InstCombine/xor.ll:1.11	Sun Feb 15 19:19:52 2004
+++ llvm/test/Regression/Transforms/InstCombine/xor.ll	Sun Feb 15 21:53:44 2004
@@ -3,6 +3,9 @@
 
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'xor '
 
+%G1 = global uint 0
+%G2 = global uint 0
+
 implementation
 
 bool %test0(bool %A) {
@@ -128,3 +131,14 @@
 	%D = xor uint %C, %A  ; A terms cancel, D = B
 	ret uint %D
 }
+
+void %test20(uint %A, uint %B) {  ; The "swap idiom"
+        %tmp.2 = xor uint %B, %A
+        %tmp.5 = xor uint %tmp.2, %B
+        %tmp.8 = xor uint %tmp.5, %tmp.2
+        store uint %tmp.8, uint* %G1   ; tmp.8 = B
+        store uint %tmp.5, uint* %G2   ; tmp.5 = A
+        ret void
+}
+
+





More information about the llvm-commits mailing list