xref: /llvm-project/llvm/test/CodeGen/Thumb2/thumb2-execute-only-long-calls.ll (revision 4f19c6a7c74238875d8568e24b0ae39716aa2091)
1; RUN: llc < %s -mtriple=thumbv7em-arm-none-eabi -relocation-model=static | FileCheck %s -check-prefixes=CHECK,STATIC
2; RUN: llc < %s -mtriple=thumbv7em-arm-none-eabi -relocation-model=rwpi | FileCheck %s -check-prefixes=CHECK,RWPI
3
4define void @fn() #0 {
5entry:
6; CHECK-LABEL: fn:
7; CHECK:       ldr [[REG:r[0-9]+]], .LCPI0_0
8; CHECK-NEXT:  blx [[REG]]
9; CHECK:       .LCPI0_0:
10; CHECK-NEXT:  .long   bar
11  call void @bar()
12  ret void
13}
14
15define void @execute_only_fn() #1 {
16; STATIC-LABEL: execute_only_fn:
17; STATIC:       movw    [[REG0:r[0-9]+]], :lower16:bar
18; STATIC-NEXT:  movt    [[REG0]], :upper16:bar
19; STATIC-NEXT:  blx     [[REG0]]
20; STATIC-NOT:   .LCPI0_0:
21
22; RWPI-LABEL: execute_only_fn:
23; RWPI:       movw    [[REG0:r[0-9]+]], :lower16:bar
24; RWPI-NEXT:  movt    [[REG0]], :upper16:bar
25; RWPI-NEXT:  blx     [[REG0]]
26; RWPI-NOT:   .LCPI1_0:
27entry:
28  call void @bar()
29  ret void
30}
31
32attributes #0 = { noinline optnone "target-features"="+thumb-mode,+long-calls" }
33attributes #1 = { noinline optnone "target-features"="+execute-only,+thumb-mode,+long-calls" }
34
35declare dso_local void @bar()
36