summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-16 03:53:44 +0000
committerChris Lattner <sabre@nondot.org>2004-02-16 03:53:44 +0000
commit98c26a7842866e3cb4ff8ddaa85346bcbde9ee80 (patch)
tree49bf1b42b0eb16051f62d9b8d089182589a46edf
parentc207635fd5a7c197ef84e762787b7fca81dd0652 (diff)
downloadbcm5719-llvm-98c26a7842866e3cb4ff8ddaa85346bcbde9ee80.tar.gz
bcm5719-llvm-98c26a7842866e3cb4ff8ddaa85346bcbde9ee80.zip
Add a test for the "swap idiom", which LLVM should be able to unravel.
llvm-svn: 11491
-rw-r--r--llvm/test/Regression/Transforms/InstCombine/xor.ll14
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/test/Regression/Transforms/InstCombine/xor.ll b/llvm/test/Regression/Transforms/InstCombine/xor.ll
index 29f0f10fddf..772c4805881 100644
--- a/llvm/test/Regression/Transforms/InstCombine/xor.ll
+++ b/llvm/test/Regression/Transforms/InstCombine/xor.ll
@@ -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 @@ uint %test19(uint %A, uint %B) {
%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
+}
+
+
OpenPOWER on IntegriCloud