File: mir-target-flags.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.8-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,388 kB
  • sloc: cpp: 7,438,767; ansic: 1,393,871; asm: 1,012,926; python: 241,728; f90: 86,635; objc: 75,411; 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 (70 lines) | stat: -rw-r--r-- 3,404 bytes parent folder | download | duplicates (4)
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
62
63
64
65
66
67
68
69
70
; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --stop-after loongarch-prera-expand-pseudo \
; RUN:     --relocation-model=pic --code-model=small %s -o %t.mir
; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --run-pass loongarch-prera-expand-pseudo \
; RUN:     %t.mir -o - | FileCheck %s
; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --stop-after loongarch-prera-expand-pseudo \
; RUN:     --relocation-model=pic --enable-tlsdesc --code-model=small %s -o %t.desc.mir
; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --run-pass loongarch-prera-expand-pseudo \
; RUN:     %t.desc.mir -o - | FileCheck %s --check-prefix=DESC

; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --stop-after loongarch-prera-expand-pseudo \
; RUN:     --relocation-model=pic --code-model=medium %s -o %t.med.mir
; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --run-pass loongarch-prera-expand-pseudo \
; RUN:     --code-model=medium %t.med.mir -o - | FileCheck %s
; RUN: llc --mtriple=loongarch64 -mattr=+d,-relax --run-pass loongarch-expand-pseudo \
; RUN:     --code-model=medium %t.med.mir -o - | FileCheck %s --check-prefixes=CALL36

;; This tests the LoongArch-specific serialization and deserialization of
;; `target-flags(...)`

@g_e = external global i32
@g_i = internal global i32 0
@t_un = external thread_local global i32
@t_ld = external thread_local(localdynamic) global i32
@t_ie = external thread_local(initialexec) global i32
@t_le = external thread_local(localexec) global i32

declare void @callee1() nounwind
declare dso_local void @callee2() nounwind
declare dso_local void @callee3() nounwind

define void @caller() nounwind {
; CHECK-LABEL: name: caller
; CHECK:      target-flags(loongarch-got-pc-hi) @g_e
; CHECK-NEXT: target-flags(loongarch-got-pc-lo) @g_e
; CHECK:      target-flags(loongarch-pcrel-hi) @g_i
; CHECK-NEXT: target-flags(loongarch-pcrel-lo) @g_i
; CHECK:      target-flags(loongarch-gd-pc-hi) @t_un
; CHECK-NEXT: target-flags(loongarch-got-pc-lo) @t_un
; DESC:       target-flags(loongarch-desc-pc-hi) @t_un
; DESC-NEXT:  target-flags(loongarch-desc-pc-lo) @t_un
; DESC-NEXT:  target-flags(loongarch-desc-ld) @t_un
; DESC-NEXT:  target-flags(loongarch-desc-call) @t_un
; CHECK:      target-flags(loongarch-ld-pc-hi) @t_ld
; CHECK-NEXT: target-flags(loongarch-got-pc-lo) @t_ld
; DESC:       target-flags(loongarch-desc-pc-hi) @t_ld
; DESC-NEXT:  target-flags(loongarch-desc-pc-lo) @t_ld
; DESC-NEXT:  target-flags(loongarch-desc-ld) @t_ld
; DESC-NEXT:  target-flags(loongarch-desc-call) @t_ld
; CHECK:      target-flags(loongarch-ie-pc-hi) @t_ie
; CHECK-NEXT: target-flags(loongarch-ie-pc-lo) @t_ie
; CHECK:      target-flags(loongarch-le-hi-r) @t_le
; CHECK-NEXT: target-flags(loongarch-le-add-r) @t_le
; CHECK-NEXT: target-flags(loongarch-le-lo-r) @t_le
; CHECK:      target-flags(loongarch-call-plt) @callee1
; CALL36:     target-flags(loongarch-call36) @callee1
; CHECK:      target-flags(loongarch-call) @callee2
; CALL36:     target-flags(loongarch-call36) @callee2
; CHECK:      target-flags(loongarch-call) @callee3
; CALL36:     target-flags(loongarch-call36) @callee3
  %a = load volatile i32, ptr @g_e
  %b = load volatile i32, ptr @g_i
  %c = load volatile i32, ptr @t_un
  %d = load volatile i32, ptr @t_ld
  %e = load volatile i32, ptr @t_ie
  %f = load volatile i32, ptr @t_le
  call i32 @callee1()
  call i32 @callee2()
  tail call i32 @callee3()
  ret void
}