blob: d5cd2a9b72e1d50587073b7ca8e2b509ceea3b77 [file] [log] [blame]
Tim Northoverdee86042013-12-02 14:46:26 +00001; RUN: llc -mtriple=thumbv7s %s -o - | FileCheck %s
2; RUN: llc -mtriple=armv7s %s -o - | FileCheck %s
3
4; CodeGen should be able to set and reset the MinSize subtarget-feature, and
5; make use of it in deciding whether to use MOVW/MOVT for global variables or a
6; lit-pool load (saving roughly 2 bytes of code).
7
8@var = global i32 0
9
10define i32 @small_global() minsize {
11; CHECK-LABEL: small_global:
12; CHECK: ldr r[[GLOBDEST:[0-9]+]], {{.?LCPI0_0}}
13; CHECK: ldr r0, [r[[GLOBDEST]]]
14
15 %val = load i32* @var
16 ret i32 %val
17}
18
19define i32 @big_global() {
20; CHECK-LABEL: big_global:
21; CHECK: movw [[GLOBDEST:r[0-9]+]], :lower16:var
22; CHECK: movt [[GLOBDEST]], :upper16:var
23
24 %val = load i32* @var
25 ret i32 %val
26}