blob: 61cd75c9cca973891f2c7bceef538f8dff58ec84 [file] [log] [blame]
Dan Gohman946223f2009-05-11 18:02:53 +00001; RUN: llvm-as < %s | llc -march=x86-64 > %t
2; RUN: grep negl %t | count 1
3; RUN: not grep sub %t
4; RUN: grep mov %t | count 1
5; RUN: grep {leal -4(} %t | count 1
6
7; ISel the add of -4 with a neg and use an lea for the rest of the
8; arithemtic.
9
10define i32 @test(i32 %x_offs) nounwind readnone {
11entry:
12 %t0 = icmp sgt i32 %x_offs, 4 ; <i1> [#uses=1]
13 br i1 %t0, label %bb.nph, label %bb2
14
15bb.nph: ; preds = %entry
16 %tmp = add i32 %x_offs, -5 ; <i32> [#uses=1]
17 %tmp6 = lshr i32 %tmp, 2 ; <i32> [#uses=1]
18 %tmp7 = mul i32 %tmp6, -4 ; <i32> [#uses=1]
19 %tmp8 = add i32 %tmp7, %x_offs ; <i32> [#uses=1]
20 %tmp9 = add i32 %tmp8, -4 ; <i32> [#uses=1]
21 ret i32 %tmp9
22
23bb2: ; preds = %entry
24 ret i32 %x_offs
25}