1 ; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --stop-after loongarch-prera-expand-pseudo \
2 ; RUN: --relocation-model=pic --code-model=medium %s -o %t.mir
3 ; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --run-pass loongarch-prera-expand-pseudo \
4 ; RUN: --code-model=medium %t.mir -o - | FileCheck %s --check-prefixes=CHECK,MEDCALL
5 ; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --run-pass loongarch-expand-pseudo \
6 ; RUN: --code-model=medium %t.mir -o - | FileCheck %s --check-prefixes=CHECK,CALL36
8 ; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --stop-after loongarch-prera-expand-pseudo \
9 ; RUN: --relocation-model=pic --enable-tlsdesc --code-model=medium %s -o %t.desc.mir
10 ; RUN: llc --mtriple=loongarch64 -mattr=+d,+relax --run-pass loongarch-prera-expand-pseudo \
11 ; RUN: --code-model=medium %t.desc.mir -o - | FileCheck %s --check-prefix=DESC
13 ;; Check target-flags after expand-pseudo pass.
15 @g_e = external global i32
16 @g_i = internal global i32 0
17 @t_un = external thread_local global i32
18 @t_ld = external thread_local(localdynamic) global i32
19 @t_ie = external thread_local(initialexec) global i32
20 @t_le = external thread_local(localexec) global i32
22 declare void @callee1() nounwind
23 declare dso_local void @callee2() nounwind
24 declare dso_local void @callee3() nounwind
26 define void @caller() nounwind {
27 ; CHECK: target-flags(loongarch-got-pc-hi, loongarch-relax) @g_e
28 ; CHECK-NEXT: target-flags(loongarch-got-pc-lo, loongarch-relax) @g_e
29 ; CHECK: target-flags(loongarch-pcrel-hi, loongarch-relax) @g_i
30 ; CHECK-NEXT: target-flags(loongarch-pcrel-lo, loongarch-relax) @g_i
31 ; CHECK: target-flags(loongarch-gd-pc-hi, loongarch-relax) @t_un
32 ; CHECK-NEXT: target-flags(loongarch-got-pc-lo, loongarch-relax) @t_un
33 ; DESC: target-flags(loongarch-desc-pc-hi, loongarch-relax) @t_un
34 ; DESC-NEXT: target-flags(loongarch-desc-pc-lo, loongarch-relax) @t_un
35 ; DESC-NEXT: target-flags(loongarch-desc-ld, loongarch-relax) @t_un
36 ; DESC-NEXT: target-flags(loongarch-desc-call, loongarch-relax) @t_un
37 ; CHECK: target-flags(loongarch-ld-pc-hi, loongarch-relax) @t_ld
38 ; CHECK-NEXT: target-flags(loongarch-got-pc-lo, loongarch-relax) @t_ld
39 ; DESC: target-flags(loongarch-desc-pc-hi, loongarch-relax) @t_ld
40 ; DESC-NEXT: target-flags(loongarch-desc-pc-lo, loongarch-relax) @t_ld
41 ; DESC-NEXT: target-flags(loongarch-desc-ld, loongarch-relax) @t_ld
42 ; DESC-NEXT: target-flags(loongarch-desc-call, loongarch-relax) @t_ld
43 ; CHECK: target-flags(loongarch-ie-pc-hi, loongarch-relax) @t_ie
44 ; CHECK-NEXT: target-flags(loongarch-ie-pc-lo, loongarch-relax) @t_ie
45 ; CHECK: target-flags(loongarch-le-hi-r) @t_le
46 ; CHECK-NEXT: target-flags(loongarch-le-add-r) @t_le
47 ; CHECK-NEXT: target-flags(loongarch-le-lo-r) @t_le
48 ; MEDCALL: target-flags(loongarch-call-plt) @callee1
49 ; CALL36: target-flags(loongarch-call36) @callee1
50 ; MEDCALL: target-flags(loongarch-call) @callee2
51 ; CALL36: target-flags(loongarch-call36) @callee2
52 ; MEDCALL: target-flags(loongarch-call) @callee3
53 ; CALL36: target-flags(loongarch-call36) @callee3
54 %a = load volatile i32, ptr @g_e
55 %b = load volatile i32, ptr @g_i
56 %c = load volatile i32, ptr @t_un
57 %d = load volatile i32, ptr @t_ld
58 %e = load volatile i32, ptr @t_ie
59 %f = load volatile i32, ptr @t_le
62 tail call i32 @callee3()