Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / test / CodeGen / LoongArch / patchable-function-entry.ll
blobfdb9288c2bd7df54347b67c2b07587b644c61efc
1 ;; Test the function attribute "patchable-function-entry".
2 ;; Adapted from the RISCV test case.
3 ; RUN: llc --mtriple=loongarch32 -mattr=+d < %s | FileCheck %s --check-prefixes=CHECK,LA32
4 ; RUN: llc --mtriple=loongarch64 -mattr=+d < %s | FileCheck %s --check-prefixes=CHECK,LA64
6 define void @f0() "patchable-function-entry"="0" {
7 ; CHECK-LABEL: f0:
8 ; CHECK-NEXT:  .Lfunc_begin0:
9 ; CHECK-NOT:     nop
10 ; CHECK:         ret
11 ; CHECK-NOT:   .section __patchable_function_entries
12   ret void
15 define void @f1() "patchable-function-entry"="1" {
16 ; CHECK-LABEL: f1:
17 ; CHECK-NEXT: .Lfunc_begin1:
18 ; CHECK:         nop
19 ; CHECK-NEXT:    ret
20 ; CHECK:       .section __patchable_function_entries,"awo",@progbits,f1{{$}}
21 ; LA32:        .p2align 2
22 ; LA32-NEXT:   .word .Lfunc_begin1
23 ; LA64:        .p2align 3
24 ; LA64-NEXT:   .dword .Lfunc_begin1
25   ret void
28 $f5 = comdat any
29 define void @f5() "patchable-function-entry"="5" comdat {
30 ; CHECK-LABEL:   f5:
31 ; CHECK-NEXT:    .Lfunc_begin2:
32 ; CHECK-COUNT-5:   nop
33 ; CHECK-NEXT:      ret
34 ; CHECK:         .section __patchable_function_entries,"awoG",@progbits,f5,f5,comdat{{$}}
35 ; LA32:          .p2align 2
36 ; LA32-NEXT:     .word .Lfunc_begin2
37 ; LA64:          .p2align 3
38 ; LA64-NEXT:     .dword .Lfunc_begin2
39   ret void
42 ;; -fpatchable-function-entry=3,2
43 ;; "patchable-function-prefix" emits data before the function entry label.
44 define void @f3_2() "patchable-function-entry"="1" "patchable-function-prefix"="2" {
45 ; CHECK-LABEL:   .type f3_2,@function
46 ; CHECK-NEXT:    .Ltmp0:
47 ; CHECK-COUNT-2:   nop
48 ; CHECK-NEXT:    f3_2:  # @f3_2
49 ; CHECK:         # %bb.0:
50 ; CHECK-NEXT:      nop
51 ; LA32-NEXT:       addi.w $sp, $sp, -16
52 ; LA64-NEXT:       addi.d $sp, $sp, -16
53 ;; .size does not include the prefix.
54 ; CHECK:      .Lfunc_end3:
55 ; CHECK-NEXT: .size f3_2, .Lfunc_end3-f3_2
56 ; CHECK:      .section __patchable_function_entries,"awo",@progbits,f3_2{{$}}
57 ; LA32:       .p2align 2
58 ; LA32-NEXT:  .word .Ltmp0
59 ; LA64:       .p2align 3
60 ; LA64-NEXT:  .dword .Ltmp0
61   %frame = alloca i8, i32 16
62   ret void