| Dan Gohman | 954f490 | 2010-01-19 23:30:49 +0000 | [diff] [blame] | 1 | ; RUN: llc -march=x86-64 < %s | not grep negq |
| 2 | |||||
| 3 | ; These sequences don't need neg instructions; they can be done with | ||||
| 4 | ; a single shift and sub each. | ||||
| 5 | |||||
| 6 | define i64 @foo(i64 %x, i64 %y, i64 %n) nounwind { | ||||
| 7 | %a = sub i64 0, %y | ||||
| 8 | %b = shl i64 %a, %n | ||||
| 9 | %c = add i64 %b, %x | ||||
| 10 | ret i64 %c | ||||
| 11 | } | ||||
| 12 | define i64 @boo(i64 %x, i64 %y, i64 %n) nounwind { | ||||
| 13 | %a = sub i64 0, %y | ||||
| 14 | %b = shl i64 %a, %n | ||||
| 15 | %c = add i64 %x, %b | ||||
| 16 | ret i64 %c | ||||
| 17 | } | ||||