• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mcpu=cortex-a8 -relocation-model=static %s -o - | \
2; RUN:   FileCheck -check-prefixes=CHECK,NO-OPTION,NO-OPTION-COMMON %s
3; RUN: llc -mcpu=cortex-a8 -relocation-model=static %s -o - -mattr=-no-movt | \
4; RUN:   FileCheck -check-prefixes=CHECK,USE-MOVT,USE-MOVT-COMMON %s
5; RUN: llc -mcpu=cortex-a8 -relocation-model=static %s -o - -mattr=+no-movt | \
6; RUN:   FileCheck -check-prefixes=CHECK,NO-USE-MOVT,NO-USE-MOVT-COMMON %s
7; RUN: llc -mcpu=cortex-a8 -relocation-model=static %s -o - -O0 | \
8; RUN:   FileCheck -check-prefixes=CHECK,NO-OPTION-O0,NO-OPTION-COMMON %s
9; RUN: llc -mcpu=cortex-a8 -relocation-model=static %s -o - -O0 -mattr=-no-movt | \
10; RUN:  FileCheck -check-prefixes=CHECK,USE-MOVT-O0,USE-MOVT-COMMON %s
11; RUN: llc -mcpu=cortex-a8 -relocation-model=static %s -o - -O0 -mattr=+no-movt | \
12; RUN:   FileCheck -check-prefixes=CHECK,NO-USE-MOVT-O0,NO-USE-MOVT-COMMON %s
13
14target triple = "thumb-apple-darwin"
15
16; NO-OPTION-COMMON-LABEL: {{_?}}foo0
17; NO-OPTION-COMMON: ldr [[R0:r[0-9]+]], [[L0:.*]]
18; NO-OPTION-COMMON: [[L0]]:
19; NO-OPTION-COMMON: .long 2296237089
20
21; USE-MOVT-COMMON-LABEL: {{_?}}foo0
22; USE-MOVT-COMMON: movw [[R0:r[0-9]+]], #52257
23; USE-MOVT-COMMON: movt [[R0]], #35037
24
25; NO-USE-MOVT-COMMON-LABEL: {{_?}}foo0
26; NO-USE-MOVT-COMMON: ldr [[R0:r[0-9]+]], [[L0:.*]]
27; NO-USE-MOVT-COMMON: [[L0]]:
28; NO-USE-MOVT-COMMON: .long 2296237089
29
30define i32 @foo0(i32 %a) #0 {
31  %1 = xor i32 -1998730207, %a
32  ret i32 %1
33}
34
35; NO-OPTION-COMMON-LABEL: {{_?}}foo1
36; NO-OPTION-COMMON: movw [[R0:r[0-9]+]], #52257
37; NO-OPTION-COMMON: movt [[R0]], #35037
38
39; USE-MOVT-COMMON-LABEL: {{_?}}foo1
40; USE-MOVT-COMMON: movw [[R0:r[0-9]+]], #52257
41; USE-MOVT-COMMON: movt [[R0]], #35037
42
43; NO-USE-MOVT-COMMON-LABEL: {{_?}}foo1
44; NO-USE-MOVT-COMMON: ldr [[R0:r[0-9]+]], [[L0:.*]]
45; NO-USE-MOVT-COMMON: [[L0]]:
46; NO-USE-MOVT-COMMON: .long 2296237089
47
48define i32 @foo1(i32 %a) {
49  %1 = xor i32 -1998730207, %a
50  ret i32 %1
51}
52
53; NO-OPTION-COMMON-LABEL: {{_?}}foo2
54; NO-OPTION:   mov.w	[[R0:r[0-9]+]], #-536813568
55; NO-OPTION-O0: movw	[[R0:r[0-9]+]], #57344
56; NO-OPTION-O0: movt	[[R0]], #57344
57
58; USE-MOVT-COMMON-LABEL: {{_?}}foo2
59; USE-MOVT:     mov.w [[R0:r[0-9]+]], #-536813568
60; USE-MOVT-O0:  movw  [[R0:r[0-9]+]], #57344
61; USE-MOVT-O0:  movt  [[R0]], #57344
62
63; NO-USE-MOVT-COMMON-LABEL: {{_?}}foo2
64; NO-USE-MOVT: mov.w	[[R0:r[0-9]+]], #-536813568
65; NO-USE-MOVT-O0: ldr [[R0:r[0-9]+]], [[L0:.*]]
66; NO-USE-MOVT-O0: [[L0]]:
67; NO-USE-MOVT-O0: .long 3758153728     @ 0xe000e000
68
69define i32 @foo2() {
70  %1 = load i32, i32* inttoptr (i32 -536813568 to i32*) ; load from 0xe000e000
71  ret i32 %1
72}
73attributes #0 = { "target-features"="+no-movt" }
74
75define hidden i32 @no_litpool() minsize optsize {
76; CHECK-LABEL:  no_litpool:
77; CHECK:        mov.w r{{.}}, #65536
78; CHECK:        mov.w r{{.}}, #-134217728
79; CHECK:        mvn r{{.}}, #-134217728
80entry:
81  %call0 = tail call i32 @eat_const(i32 65536)
82  %call1 = tail call i32 @eat_const(i32 -134217728)
83  %call2 = tail call i32 @eat_const(i32 134217727)
84  ret i32 %call2
85}
86
87define hidden i32 @litpool() minsize optsize {
88; CHECK-LABEL:  litpool:
89; CHECK:        ldr r0, {{.*}}LCPI{{.*}}
90; CHECK-NEXT:   b.w {{.*}}eat_const
91entry:
92  %call1 = tail call i32 @eat_const(i32 8388601)
93  ret i32 %call1
94}
95
96declare dso_local i32 @eat_const(i32)
97
98