From 057364449428746dfba99bfce7f75c90b3f6aa9c Mon Sep 17 00:00:00 2001 From: Ed_ Date: Tue, 2 Jun 2026 01:34:54 -0400 Subject: [PATCH] slight adjsutments --- code/duffle/dsl.h | 18 ------------------ code/duffle/gcc_asm.h | 19 +++++++++++++++++++ code/duffle/gte.h | 21 --------------------- 3 files changed, 19 insertions(+), 39 deletions(-) diff --git a/code/duffle/dsl.h b/code/duffle/dsl.h index 12b5c4a..f2a48b0 100644 --- a/code/duffle/dsl.h +++ b/code/duffle/dsl.h @@ -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 diff --git a/code/duffle/gcc_asm.h b/code/duffle/gcc_asm.h index e057f89..acb4990 100644 --- a/code/duffle/gcc_asm.h +++ b/code/duffle/gcc_asm.h @@ -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. * diff --git a/code/duffle/gte.h b/code/duffle/gte.h index cfd97ee..e4f8ffc 100644 --- a/code/duffle/gte.h +++ b/code/duffle/gte.h @@ -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;" \