summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/commute-two-addr.ll
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-01-02 02:30:04 +0000
committerChris Lattner <sabre@nondot.org>2005-01-02 02:30:04 +0000
commitae37c2a543642b0b3a8b5f082fd12d9ec281aad4 (patch)
treec9083423f50845b4ee901cb562dc1d44554442e6 /test/CodeGen/X86/commute-two-addr.ll
parentaad75aa1a235ec1ab121ec2a9c745577493ed323 (diff)
downloadllvm-ae37c2a543642b0b3a8b5f082fd12d9ec281aad4.tar.gz
llvm-ae37c2a543642b0b3a8b5f082fd12d9ec281aad4.tar.bz2
llvm-ae37c2a543642b0b3a8b5f082fd12d9ec281aad4.tar.xz
Add several testcases for new optimizations in the code generator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19244 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/commute-two-addr.ll')
-rw-r--r--test/CodeGen/X86/commute-two-addr.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CodeGen/X86/commute-two-addr.ll b/test/CodeGen/X86/commute-two-addr.ll
new file mode 100644
index 0000000000..860c159790
--- /dev/null
+++ b/test/CodeGen/X86/commute-two-addr.ll
@@ -0,0 +1,21 @@
+; The register allocator can commute two-address instructions to avoid
+; insertion of register-register copies.
+
+; Check that there are no register-register copies left.
+; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov %E.X, %E.X'
+
+%G = external global int
+
+declare void %ext(int)
+
+int %add_test(int %X, int %Y) {
+ %Z = add int %X, %Y ;; Last use of Y, but not of X.
+ store int %Z, int* %G
+ ret int %X
+}
+
+int %xor_test(int %X, int %Y) {
+ %Z = xor int %X, %Y ;; Last use of Y, but not of X.
+ store int %Z, int* %G
+ ret int %X
+}