xref: /llvm-project/llvm/test/CodeGen/LoongArch/test_bl_fixupkind.mir (revision 9d4f7f44b64d87d1068859906f43b7ce03a7388b)
1# RUN: llc --mtriple=loongarch64 -mattr=+d --filetype=obj %s -o - | \
2# RUN: llvm-objdump -d - | FileCheck %s
3
4# REQUIRES: asserts
5
6## Check that bl can get fixupkind correctly, whether BL contains
7## target-flags(loongarch-call) or not.
8
9--- |
10  target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
11  target triple = "loongarch64"
12
13  define dso_local void @test_bl_fixupkind_with_flag() {
14  ; CHECK-LABEL: test_bl_fixupkind_with_flag
15  ; CHECK:         addi.d $sp, $sp, -16
16  ; CHECK-NEXT:    st.d $ra, $sp, 8
17  ; CHECK-NEXT:    bl 0 <test_bl_fixupkind_with_flag+0x8>
18  ; CHECK-NEXT:    ld.d $ra, $sp, 8
19  ; CHECK-NEXT:    addi.d $sp, $sp, 16
20  ; CHECK-NEXT:    ret
21  entry:
22    call void @foo()
23    ret void
24  }
25
26  define dso_local void @test_bl_fixupkind_without_flag() {
27  ; CHECK-LABEL: test_bl_fixupkind_without_flag
28  ; CHECK:         addi.d $sp, $sp, -16
29  ; CHECK-NEXT:    st.d $ra, $sp, 8
30  ; CHECK-NEXT:    bl 0 <test_bl_fixupkind_without_flag+0x8>
31  ; CHECK-NEXT:    ld.d $ra, $sp, 8
32  ; CHECK-NEXT:    addi.d $sp, $sp, 16
33  ; CHECK-NEXT:    ret
34  entry:
35    call void @foo()
36    ret void
37  }
38
39  declare dso_local void @foo(...)
40...
41---
42name:            test_bl_fixupkind_with_flag
43tracksRegLiveness: true
44body:             |
45  bb.0.entry:
46    ADJCALLSTACKDOWN 0, 0, implicit-def dead $r3, implicit $r3
47    BL target-flags(loongarch-call) @foo, csr_ilp32d_lp64d, implicit-def $r1, implicit-def dead $r1, implicit-def $r3
48    ADJCALLSTACKUP 0, 0, implicit-def dead $r3, implicit $r3
49    PseudoRET
50
51...
52---
53name:            test_bl_fixupkind_without_flag
54tracksRegLiveness: true
55body:             |
56  bb.0.entry:
57    ADJCALLSTACKDOWN 0, 0, implicit-def dead $r3, implicit $r3
58    BL @foo, csr_ilp32d_lp64d, implicit-def $r1, implicit-def dead $r1, implicit-def $r3
59    ADJCALLSTACKUP 0, 0, implicit-def dead $r3, implicit $r3
60    PseudoRET
61
62...
63