Add several testcases for new optimizations in the code generator.
[oota-llvm.git] / test / CodeGen / X86 / commute-two-addr.ll
1 ; The register allocator can commute two-address instructions to avoid
2 ; insertion of register-register copies.
3
4 ; Check that there are no register-register copies left.
5 ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | not grep 'mov %E.X, %E.X'
6
7 %G = external global int
8
9 declare void %ext(int)
10
11 int %add_test(int %X, int %Y) {
12         %Z = add int %X, %Y      ;; Last use of Y, but not of X.
13         store int %Z, int* %G
14         ret int %X
15 }
16
17 int %xor_test(int %X, int %Y) {
18         %Z = xor int %X, %Y      ;; Last use of Y, but not of X.
19         store int %Z, int* %G
20         ret int %X
21 }