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
|
; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --stop-after loongarch-prera-expand-pseudo \
; RUN: --relocation-model=pic --code-model=medium %s -o %t.mir
; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --run-pass loongarch-prera-expand-pseudo \
; RUN: --code-model=medium %t.mir -o - | FileCheck %s --check-prefixes=CHECK,MEDCALL
; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --run-pass loongarch-expand-pseudo \
; RUN: --code-model=medium %t.mir -o - | FileCheck %s --check-prefixes=CHECK,CALL36
; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --stop-after loongarch-prera-expand-pseudo \
; RUN: --relocation-model=pic --enable-tlsdesc --code-model=medium %s -o %t.desc.mir
; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --run-pass loongarch-prera-expand-pseudo \
; RUN: --code-model=medium %t.desc.mir -o - | FileCheck %s --check-prefix=DESC
;; Check target-flags after expand-pseudo pass.
@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: target-flags(loongarch-got-pc-hi, loongarch-relax) @g_e
; CHECK-NEXT: target-flags(loongarch-got-pc-lo, loongarch-relax) @g_e
; CHECK: target-flags(loongarch-pcrel-hi, loongarch-relax) @g_i
; CHECK-NEXT: target-flags(loongarch-pcrel-lo, loongarch-relax) @g_i
; CHECK: target-flags(loongarch-gd-pc-hi, loongarch-relax) @t_un
; CHECK-NEXT: target-flags(loongarch-got-pc-lo, loongarch-relax) @t_un
; DESC: target-flags(loongarch-desc-pc-hi, loongarch-relax) @t_un
; DESC-NEXT: target-flags(loongarch-desc-pc-lo, loongarch-relax) @t_un
; DESC-NEXT: target-flags(loongarch-desc-ld, loongarch-relax) @t_un
; DESC-NEXT: target-flags(loongarch-desc-call, loongarch-relax) @t_un
; CHECK: target-flags(loongarch-ld-pc-hi, loongarch-relax) @t_ld
; CHECK-NEXT: target-flags(loongarch-got-pc-lo, loongarch-relax) @t_ld
; DESC: target-flags(loongarch-desc-pc-hi, loongarch-relax) @t_ld
; DESC-NEXT: target-flags(loongarch-desc-pc-lo, loongarch-relax) @t_ld
; DESC-NEXT: target-flags(loongarch-desc-ld, loongarch-relax) @t_ld
; DESC-NEXT: target-flags(loongarch-desc-call, loongarch-relax) @t_ld
; CHECK: target-flags(loongarch-ie-pc-hi, loongarch-relax) @t_ie
; CHECK-NEXT: target-flags(loongarch-ie-pc-lo, loongarch-relax) @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
; MEDCALL: target-flags(loongarch-call-plt) @callee1
; CALL36: target-flags(loongarch-call36) @callee1
; MEDCALL: target-flags(loongarch-call) @callee2
; CALL36: target-flags(loongarch-call36) @callee2
; MEDCALL: 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
}
|