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" {
8 ; CHECK-NEXT: .Lfunc_begin0:
11 ; CHECK-NOT: .section __patchable_function_entries
15 define void @f1() "patchable-function-entry"="1" {
17 ; CHECK-NEXT: .Lfunc_begin1:
20 ; CHECK: .section __patchable_function_entries,"awo",@progbits,f1{{$}}
22 ; LA32-NEXT: .word .Lfunc_begin1
24 ; LA64-NEXT: .dword .Lfunc_begin1
29 define void @f5() "patchable-function-entry"="5" comdat {
31 ; CHECK-NEXT: .Lfunc_begin2:
34 ; CHECK: .section __patchable_function_entries,"awoG",@progbits,f5,f5,comdat{{$}}
36 ; LA32-NEXT: .word .Lfunc_begin2
38 ; LA64-NEXT: .dword .Lfunc_begin2
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
48 ; CHECK-NEXT: f3_2: # @f3_2
51 ; LA32-NEXT: addi.w $sp, $sp, -16
52 ; LA64-NEXT: addi.d $sp, $sp, -16
53 ;; .size does not include the prefix.
55 ; CHECK-NEXT: .size f3_2, .Lfunc_end3-f3_2
56 ; CHECK: .section __patchable_function_entries,"awo",@progbits,f3_2{{$}}
58 ; LA32-NEXT: .word .Ltmp0
60 ; LA64-NEXT: .dword .Ltmp0
61 %frame = alloca i8, i32 16