From dc2adc883524babe0ebec62d8f85372ef18bfd7a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 6 Apr 2020 00:06:27 +0000 Subject: [PATCH] rand/rand-x86ish.S: Hoist argument register allocation outside. This will soon be shared with another entry point for `rdseed'. --- rand/rand-x86ish.S | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/rand/rand-x86ish.S b/rand/rand-x86ish.S index 36176258..70907feb 100644 --- a/rand/rand-x86ish.S +++ b/rand/rand-x86ish.S @@ -37,6 +37,17 @@ ///-------------------------------------------------------------------------- /// Quick random generation. +// Common register allocation. +#if CPUFAM_X86 +# define COUNT ecx +#endif +#if CPUFAM_AMD64 && ABI_SYSV +# define COUNT ecx +#endif +#if CPUFAM_AMD64 && ABI_WIN +# define COUNT r8d +#endif + FUNC(rand_quick_x86ish_rdrand) // Enter with a pointer to the random context in the first argument. // Return zero on success, or -1 on error. @@ -44,15 +55,12 @@ FUNC(rand_quick_x86ish_rdrand) #if CPUFAM_X86 mov edx, [SP + 4] stalloc 28 -# define COUNT ecx #endif #if CPUFAM_AMD64 && ABI_SYSV stalloc 8 -# define COUNT ecx #endif #if CPUFAM_AMD64 && ABI_WIN stalloc 40 -# define COUNT r8d #endif endprologue @@ -104,9 +112,8 @@ FUNC(rand_quick_x86ish_rdrand) stfree 40 #endif ret +ENDFUNC #undef COUNT -ENDFUNC - ///----- That's all, folks -------------------------------------------------- -- 2.11.0