Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | ; The register allocator can commute two-address instructions to avoid |
| 2 | ; insertion of register-register copies. |
| 3 | |
| 4 | ; Make sure there are only 3 mov's for each testcase |
| 5 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | \ |
Dan Gohman | 8c89a50 | 2007-08-15 13:36:28 +0000 | [diff] [blame] | 6 | ; RUN: grep {\\\<mov\\\>} | count 6 |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | |
| 8 | |
| 9 | target triple = "i686-pc-linux-gnu" |
| 10 | |
| 11 | %G = external global int |
| 12 | |
| 13 | declare void %ext(int) |
| 14 | |
| 15 | int %add_test(int %X, int %Y) { |
| 16 | %Z = add int %X, %Y ;; Last use of Y, but not of X. |
| 17 | store int %Z, int* %G |
| 18 | ret int %X |
| 19 | } |
| 20 | |
| 21 | int %xor_test(int %X, int %Y) { |
| 22 | %Z = xor int %X, %Y ;; Last use of Y, but not of X. |
| 23 | store int %Z, int* %G |
| 24 | ret int %X |
| 25 | } |