Files
opencv-MIRROR/3rdparty/mlas/lib/x86/asmmacro.h
omrope79 37c9ab1815 Merge pull request #29226 from omrope79:fix_mlas_x86
Fix MLAS 32-bit x86 build by integrating missing upstream assembly files #29226

### Pull Request Readiness Checklist

This resolves the 32-bit x86 build failure for MLAS. Related to: https://github.com/opencv/opencv/pull/29218

* Added the required `x86` assembly files and headers from upstream.
* Added `__x86_64__` guards around the AMX `syscall` and the FMA3/AVX512F kernel assignments to prevent 32-bit compilation crashes.

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [x] The feature is well documented and sample code can be built with the project CMake
2026-06-04 23:33:54 +03:00

80 lines
1.3 KiB
C

/*++
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License.
Module Name:
asmmacro.h
Abstract:
This module implements common macros for the assembly modules.
--*/
#if defined(__APPLE__)
#define C_UNDERSCORE(symbol) _##symbol
#else
#define C_UNDERSCORE(symbol) symbol
#endif
/*++
Macro Description:
This macro emits the assembler directives to annotate a new function.
Arguments:
FunctionName - Supplies the name of the function.
--*/
.macro FUNCTION_ENTRY FunctionName
.p2align 4
#if defined(__APPLE__)
.globl _\FunctionName\()
_\FunctionName\():
#else
.globl \FunctionName\()
.type \FunctionName\(),@function
\FunctionName\():
#endif
.endm
/*++
Macro Description:
This macro emits the code to load the global offset table address into the
supplied register.
Arguments:
TargetReg - Specifies the target register.
--*/
.macro LoadGlobalOffsetTable, TargetReg
//
// The LLVM integrated assembler doesn't support the Intel syntax for OFFSET:
//
// add ebx,OFFSET _GLOBAL_OFFSET_TABLE_
//
// Workaround this by temporarily switching to AT&T syntax.
//
.att_syntax
calll __x86.get_pc_thunk.\TargetReg\()
addl $_GLOBAL_OFFSET_TABLE_,%e\TargetReg\()
.intel_syntax noprefix
.endm