Switch to ImmLeaf (which can be used by FastISel) for a few more common ARM/Thumb2...
[oota-llvm.git] / test / CodeGen / ARM / fast-isel.ll
1 ; RUN: llc < %s -O0 -fast-isel-abort -mtriple=armv7-apple-darwin | FileCheck %s --check-prefix=ARM
2 ; RUN: llc < %s -O0 -fast-isel-abort -mtriple=thumbv7-apple-darwin | FileCheck %s --check-prefix=THUMB
3
4 ; Very basic fast-isel functionality.
5 define i32 @add(i32 %a, i32 %b) nounwind {
6 entry:
7   %a.addr = alloca i32, align 4
8   %b.addr = alloca i32, align 4
9   store i32 %a, i32* %a.addr
10   store i32 %b, i32* %b.addr
11   %tmp = load i32* %a.addr
12   %tmp1 = load i32* %b.addr
13   %add = add nsw i32 %tmp, %tmp1
14   ret i32 %add
15 }
16
17 ; Check truncate to bool
18 define void @test1(i32 %tmp) nounwind {
19 entry:
20 %tobool = trunc i32 %tmp to i1
21 br i1 %tobool, label %if.then, label %if.end
22
23 if.then:                                          ; preds = %entry
24 call void @test1(i32 0)
25 br label %if.end
26
27 if.end:                                           ; preds = %if.then, %entry
28 ret void
29 ; ARM: test1:
30 ; ARM: tst r0, #1
31 ; THUMB: test1:
32 ; THUMB: tst.w r0, #1
33 }
34
35 ; Check some simple operations with immediates
36 define void @test2(i32 %tmp, i32* %ptr) nounwind {
37 ; THUMB: test2:
38 ; ARM: test2:
39
40 b1:
41   %b = add i32 %tmp, 4096
42   store i32 %b, i32* %ptr
43   br label %b2
44
45 ; THUMB: add.w {{.*}} #4096
46 ; ARM: add {{.*}} #1, #20
47
48 b2:
49   %c = or i32 %tmp, 4
50   store i32 %c, i32* %ptr
51   ret void
52
53 ; THUMB: orr {{.*}} #4
54 ; ARM: orr {{.*}} #4
55 }