blob: 224f5d5e5c54c2368cfe74ff435b0412e08829b1 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; 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
Tanya Lattner632e88a2008-02-21 07:42:26 +00005; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | \
Dan Gohman8c89a502007-08-15 13:36:28 +00006; RUN: grep {\\\<mov\\\>} | count 6
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007
8
9target triple = "i686-pc-linux-gnu"
Tanya Lattner632e88a2008-02-21 07:42:26 +000010@G = external global i32 ; <i32*> [#uses=2]
Dan Gohmanf17a25c2007-07-18 16:29:46 +000011
Tanya Lattner632e88a2008-02-21 07:42:26 +000012declare void @ext(i32)
Dan Gohmanf17a25c2007-07-18 16:29:46 +000013
Tanya Lattner632e88a2008-02-21 07:42:26 +000014define i32 @add_test(i32 %X, i32 %Y) {
15 %Z = add i32 %X, %Y ; <i32> [#uses=1]
16 store i32 %Z, i32* @G
17 ret i32 %X
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018}
19
Tanya Lattner632e88a2008-02-21 07:42:26 +000020define i32 @xor_test(i32 %X, i32 %Y) {
21 %Z = xor i32 %X, %Y ; <i32> [#uses=1]
22 store i32 %Z, i32* @G
23 ret i32 %X
Dan Gohmanf17a25c2007-07-18 16:29:46 +000024}
Tanya Lattner632e88a2008-02-21 07:42:26 +000025