ls1x-loongson-gnu-toolchain.../sysroot/usr/include/sys/asm.h
2024-11-27 15:46:37 +08:00

62 lines
1.2 KiB
C

#ifndef _SYS_ASM_H
#define _SYS_ASM_H
#include <sys/regdef.h>
#include <sysdeps/generic/sysdep.h>
/* Macros to handle different pointer/register sizes for 32/64-bit code. */
#ifdef __loongarch64
# define PTRLOG 3
# define SZREG 8
# define SZFREG 8
# define REG_L ld.d
# define REG_S st.d
# define FREG_L fld.d
# define FREG_S fst.d
# define ADD add.d
# define ADDI addi.d
# define SUB sub.d
# define SLLI slli.d
# define SRLI srli.d
# define PTR_LI li.d
#elif (defined __loongarch32) || (defined __loongarch32r)
# define PTRLOG 2
# define SZREG 4
# define SZFREG 4
# define REG_L ld.w
# define REG_S st.w
# define FREG_L fld.s
# define FREG_S fst.s
# define ADD add.w
# define ADDI addi.w
# define SUB sub.w
# define SLLI slli.w
# define SRLI srli.w
# define PTR_LI li.w
#else
# error __loongarch_xlen must equal 32 or 64
#endif
/* Declare leaf routine. */
#define LEAF(symbol) \
.text; \
.globl symbol; \
.align 3; \
cfi_startproc ; \
.type symbol, @function; \
symbol:
# define ENTRY(symbol) LEAF(symbol)
/* Mark end of function. */
#undef END
#define END(function) \
cfi_endproc ; \
.size function,.-function;
/* Stack alignment. */
#define ALMASK ~15
#endif /* sys/asm.h */