xref: /aosp_15_r20/external/XNNPACK/src/xnnpack/assembly.h (revision 4bdc94577ba0e567308109d787f7fec7b531ce36)
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 // All rights reserved.
3 //
4 // Copyright 2019 Google LLC
5 //
6 // This source code is licensed under the BSD-style license found in the
7 // LICENSE file in the root directory of this source tree.
8 
9 #ifdef __wasm__
10   .macro BEGIN_FUNCTION name
11     .text
12     .section    .text.\name,"",@
13     .hidden     \name
14     .globl      \name
15     .type       \name,@function
16     \name:
17   .endm
18 
19   .macro END_FUNCTION name
20     end_function
21   .endm
22 #elif defined(__ELF__)
23   .macro BEGIN_FUNCTION name
24     .text
25     .p2align 4
26     .global \name
27     .type \name, %function
28     \name:
29   .endm
30 
31   .macro END_FUNCTION name
32     .size \name, .-\name
33   .endm
34 #elif defined(__MACH__)
35   .macro BEGIN_FUNCTION name
36     .text
37     .p2align 4
38     .global _\name
39     .private_extern _\name
40     _\name:
41   .endm
42 
43   .macro END_FUNCTION name
44   .endm
45 #endif
46