File: cse-ldrlit.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (61 lines) | stat: -rw-r--r-- 2,087 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
; RUN: llc -mtriple=thumbv6m-apple-none-macho -relocation-model=pic -o -  %s | FileCheck %s --check-prefix=CHECK-THUMB-PIC
; RUN: llc -mtriple=arm-apple-none-macho -relocation-model=pic -o -  %s | FileCheck %s --check-prefix=CHECK-ARM-PIC
; RUN: llc -mtriple=thumbv6m-apple-none-macho -relocation-model=dynamic-no-pic -o -  %s | FileCheck %s --check-prefix=CHECK-DYNAMIC
; RUN: llc -mtriple=arm-apple-none-macho -relocation-model=dynamic-no-pic -o -  %s | FileCheck %s --check-prefix=CHECK-DYNAMIC
; RUN: llc -mtriple=thumbv6m-apple-none-macho -relocation-model=static -o -  %s | FileCheck %s --check-prefix=CHECK-STATIC
; RUN: llc -mtriple=arm-apple-none-macho -relocation-model=static -o -  %s | FileCheck %s --check-prefix=CHECK-STATIC
@var = global [16 x i32] zeroinitializer

declare void @bar(ptr)

define void @foo() {
  %flag = load i32, ptr getelementptr inbounds([16 x i32], ptr @var, i32 0, i32 1)
  %tst = icmp eq i32 %flag, 0
  br i1 %tst, label %true, label %false
true:
  tail call void @bar(ptr getelementptr inbounds([16 x i32], ptr @var, i32 0, i32 4))
  ret void
false:
  ret void
}

; CHECK-THUMB-PIC-LABEL: foo:
; CHECK-THUMB-PIC: ldr r0, LCPI0_0
; CHECK-THUMB-PIC: LPC0_0:
; CHECK-THUMB-PIC-NEXT: add r0, pc
; CHECK-THUMB-PIC: ldr {{r[1-9][0-9]?}}, [r0, #4]

; CHECK-THUMB-PIC: LCPI0_0:
; CHECK-THUMB-PIC-NEXT: .long _var-(LPC0_0+4)
; CHECK-THUMB-PIC-NOT: LCPI0_1


; CHECK-ARM-PIC-LABEL: foo:
; CHECK-ARM-PIC: ldr [[VAR_OFFSET:r[0-9]+]], LCPI0_0
; CHECK-ARM-PIC: LPC0_0:
; CHECK-ARM-PIC-NEXT: add r0, pc, [[VAR_OFFSET]]
; CHECK-ARM-PIC: ldr {{r[0-9]+}}, [r0, #4]

; CHECK-ARM-PIC: LCPI0_0:
; CHECK-ARM-PIC-NEXT: .long _var-(LPC0_0+8)
; CHECK-ARM-PIC-NOT: LCPI0_1


; CHECK-DYNAMIC-LABEL: foo:
; CHECK-DYNAMIC: ldr r0, LCPI0_0
; CHECK-DYNAMIC: ldr {{r[1-9][0-9]?}}, [r0, #4]

; CHECK-DYNAMIC: LCPI0_0:
; CHECK-DYNAMIC-NEXT: .long _var
; CHECK-DYNAMIC-NOT: LCPI0_1


; CHECK-STATIC-LABEL: foo:
; CHECK-STATIC: ldr r0, LCPI0_0
; CHECK-STATIC: ldr {{r[1-9][0-9]?}}, [r0, #4]

; CHECK-STATIC: LCPI0_0:
; CHECK-STATIC-NEXT: .long _var{{$}}
; CHECK-STATIC-NOT: LCPI0_1