blob: 7aebc383ddebe46e362d3d63d42683af496c8473 [file] [log] [blame]
Dan Gohmancd9e1552010-01-19 23:30:49 +00001; 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
6define 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}
12define 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}