mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-07-02 16:01:49 -07:00
slight adjsutments
This commit is contained in:
@@ -30,24 +30,6 @@
|
||||
#define asm __asm__
|
||||
#define align_(value) __attribute__((aligned (value))) // for easy alignment
|
||||
|
||||
/* reg_str(n) — Stringify an integer register id into the GCC asm
|
||||
* string form (e.g. 12 → "$12"). Use this anywhere GCC's parser
|
||||
* expects a literal string identifying a register: clobber lists,
|
||||
* asm templates, etc. The two-level macro is the standard preprocessor
|
||||
* idiom for forcing one level of expansion before stringify — without
|
||||
* it, `#n` would stringify the macro name `R_T4` to `"R_T4"` instead
|
||||
* of expanding `R_T4` to its value first.
|
||||
*
|
||||
* For declaring a register variable bound to a specific GPR, use the
|
||||
* `rgcc(n)` bundle from gcc_asm.h instead — it adds the `__asm__()`
|
||||
* qualifier around the string.
|
||||
*
|
||||
* register V3_S2* p0 __asm__(reg_str(R_T4)) = ...; // verbose
|
||||
* register V3_S2* p0 rgcc(R_T4) = ...; // bundled
|
||||
*
|
||||
* asm volatile("nop" : : : reg_str(R_RA), "memory"); // clobber list */
|
||||
#define reg_str_(n) "$" #n
|
||||
#define reg_str(n) reg_str_(n)
|
||||
#define align_(value) __attribute__((aligned (value))) // for easy alignment
|
||||
#define C_(type,data) ((type)(data)) // for enforced precedence
|
||||
#define expect_(x, y) __builtin_expect(x, y) // so compiler knows the common path
|
||||
|
||||
@@ -327,6 +327,25 @@
|
||||
* 3 colons total. Always valid. */
|
||||
#define asm_inline(...) m_expand(glue(_INL_, _ASM_COUNT_ARGS(__VA_ARGS__))(__VA_ARGS__))
|
||||
|
||||
/* reg_str(n) — Stringify an integer register id into the GCC asm
|
||||
* string form (e.g. 12 → "$12"). Use this anywhere GCC's parser
|
||||
* expects a literal string identifying a register: clobber lists,
|
||||
* asm templates, etc. The two-level macro is the standard preprocessor
|
||||
* idiom for forcing one level of expansion before stringify — without
|
||||
* it, `#n` would stringify the macro name `R_T4` to `"R_T4"` instead
|
||||
* of expanding `R_T4` to its value first.
|
||||
*
|
||||
* For declaring a register variable bound to a specific GPR, use the
|
||||
* `rgcc(n)` bundle from gcc_asm.h instead — it adds the `__asm__()`
|
||||
* qualifier around the string.
|
||||
*
|
||||
* register V3_S2* p0 __asm__(reg_str(R_T4)) = ...; // verbose
|
||||
* register V3_S2* p0 rgcc(R_T4) = ...; // bundled
|
||||
*
|
||||
* asm volatile("nop" : : : reg_str(R_RA), "memory"); // clobber list */
|
||||
#define reg_str_(n) "$" #n
|
||||
#define reg_str(n) reg_str_(n)
|
||||
|
||||
/* ------------------------------------------------------------------------ *
|
||||
* rgcc(n) — GCC-specific bundle for register-variable declarations.
|
||||
*
|
||||
|
||||
@@ -425,27 +425,6 @@ enum { _C2_OPS_ = 0
|
||||
asm_clobber( reg_str(R_V0_Code), reg_str(R_T0_Code), reg_str(R_T1_Code), reg_str(R_RA_Code), "memory" ) \
|
||||
)
|
||||
|
||||
#define gte_ldv0(r0) \
|
||||
__asm__ volatile( \
|
||||
"lwc2 $0, 0( %0 );" \
|
||||
"lwc2 $1, 4( %0 )" \
|
||||
: \
|
||||
: "r"(r0))
|
||||
|
||||
#define gte_ldv1(r0) \
|
||||
__asm__ volatile( \
|
||||
"lwc2 $2, 0( %0 );" \
|
||||
"lwc2 $3, 4( %0 )" \
|
||||
: \
|
||||
: "r"(r0))
|
||||
|
||||
#define gte_ldv2(r0) \
|
||||
__asm__ volatile( \
|
||||
"lwc2 $4, 0( %0 );" \
|
||||
"lwc2 $5, 4( %0 )" \
|
||||
: \
|
||||
: "r"(r0))
|
||||
|
||||
#define gte_rtpt() \
|
||||
__asm__ volatile( \
|
||||
"nop;" \
|
||||
|
||||
Reference in New Issue
Block a user