1; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mattr=+no-movt -mtriple=armv7-apple-ios     < %s | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
2; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mattr=+no-movt -mtriple=armv7-linux-gnueabi < %s | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
3; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mattr=+no-movt -mtriple=thumbv7-apple-ios   < %s | FileCheck %s --check-prefix=CHECK --check-prefix=ARM
4; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios   < %s | FileCheck %s --check-prefix=CHECK --check-prefix=THUMB
5; RUN: llc -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios     < %s | FileCheck %s --check-prefix=MOVT
6; rdar://10412592
7
8define void @t1() nounwind {
9entry:
10; CHECK-LABEL: t1
11; CHECK:       mvn r0, #0
12  call void @foo(i32 -1)
13  ret void
14}
15
16declare void @foo(i32)
17
18define void @t2() nounwind {
19entry:
20; CHECK-LABEL: t2
21; CHECK:       mvn r0, #233
22  call void @foo(i32 -234)
23  ret void
24}
25
26define void @t3() nounwind {
27entry:
28; CHECK-LABEL: t3
29; CHECK:       mvn r0, #256
30  call void @foo(i32 -257)
31  ret void
32}
33
34; Load from constant pool
35define void @t4() nounwind {
36entry:
37; ARM-LABEL:   t4
38; ARM:         ldr r0
39; THUMB-LABEL: t4
40; THUMB:       movw r0, #65278
41; THUMB:       movt r0, #65535
42  call void @foo(i32 -258)
43  ret void
44}
45
46define void @t5() nounwind {
47entry:
48; CHECK-LABEL: t5
49; CHECK:       mvn r0, #65280
50  call void @foo(i32 -65281)
51  ret void
52}
53
54define void @t6() nounwind {
55entry:
56; CHECK-LABEL: t6
57; CHECK:       mvn r0, #978944
58  call void @foo(i32 -978945)
59  ret void
60}
61
62define void @t7() nounwind {
63entry:
64; CHECK-LABEL: t7
65; CHECK:       mvn r0, #267386880
66  call void @foo(i32 -267386881)
67  ret void
68}
69
70define void @t8() nounwind {
71entry:
72; CHECK-LABEL: t8
73; CHECK:       mvn r0, #65280
74  call void @foo(i32 -65281)
75  ret void
76}
77
78define void @t9() nounwind {
79entry:
80; CHECK-LABEL: t9
81; CHECK:       mvn r0, #2130706432
82  call void @foo(i32 -2130706433)
83  ret void
84}
85
86; Load from constant pool.
87define i32 @t10(i32 %a) {
88; MOVT-LABEL: t10
89; MOVT:       ldr
90  %1 = xor i32 -1998730207, %a
91  ret i32 %1
92}
93
94