1; RUN: llc -mtriple=arm-eabi -mcpu=arm1156t2-s -mattr=+thumb2 %s -o - | FileCheck %s
2; rdar://7317664
3
4; RUN: llc -mtriple=thumbv8m.base %s -o - | FileCheck %s
5; RUN: llc -mtriple=thumbv8m.base -mcpu=cortex-m23 %s -o - | FileCheck %s --check-prefix=NOMOVT
6; RUN: llc -mtriple=thumbv8m.base -mcpu=cortex-m33 %s -o - | FileCheck %s
7; RUN: llc -mtriple=thumbv8m.base -mcpu=cortex-m35p %s -o - | FileCheck %s
8
9define i32 @t(i32 %X) nounwind {
10; CHECK-LABEL: t:
11; CHECK: movt r{{[0-9]}}, #65535
12; NOMOVT-LABEL: t:
13; NOMOVT-NOT: movt r{{[0-9]}}, #65535
14; NOMOVT: ldr r{{[0-9]}}, .LCP
15entry:
16	%0 = or i32 %X, -65536
17	ret i32 %0
18}
19
20define i32 @t2(i32 %X) nounwind {
21; CHECK-LABEL: t2:
22; CHECK: movt r{{[0-9]}}, #65534
23; NOMOVT-LABEL: t2:
24; NOMOVT-NOT: movt r{{[0-9]}}, #65534
25; NOMOVT: ldr r{{[0-9]}}, .LCP
26entry:
27	%0 = or i32 %X, -131072
28	%1 = and i32 %0, -65537
29	ret i32 %1
30}
31