Dan Gohman | 0a06310 | 2009-09-08 23:54:48 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -march=x86-64 > %t |
Dan Gohman | 5a5e6e9 | 2008-10-17 01:33:43 +0000 | [diff] [blame] | 2 | ; RUN: not grep add %t |
3 | ; RUN: grep subq %t | count 2 | ||||
4 | |||||
5 | ; The immediate can be encoded in a smaller way if the | ||||
6 | ; instruction is a sub instead of an add. | ||||
7 | |||||
8 | define i64 @foo(i64 inreg %a) nounwind { | ||||
9 | %b = add i64 %a, 2147483648 | ||||
10 | ret i64 %b | ||||
11 | } | ||||
12 | define i64 @bar(i64 inreg %a) nounwind { | ||||
13 | %b = add i64 %a, 128 | ||||
14 | ret i64 %b | ||||
15 | } |