This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e47a0dd2286 arch/x86_64: optimize assembly instructions for size and
performan
e47a0dd2286 is described below
commit e47a0dd22863b3faa3904e858091e66beee73dc6
Author: humzak711 <[email protected]>
AuthorDate: Fri Jan 23 03:28:18 2026 +0000
arch/x86_64: optimize assembly instructions for size and performan
Signed-off-by: humzak711 <[email protected]>
arch/x86_64: optimize assembly instructions for size and performance
---
arch/x86_64/src/intel64/intel64_head.S | 12 ++++++------
arch/x86_64/src/intel64/intel64_saveusercontext.S | 7 +++----
arch/x86_64/src/intel64/intel64_vectors.S | 9 ++++-----
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/arch/x86_64/src/intel64/intel64_head.S
b/arch/x86_64/src/intel64/intel64_head.S
index b5b8461a1d4..b9cc9639d3c 100644
--- a/arch/x86_64/src/intel64/intel64_head.S
+++ b/arch/x86_64/src/intel64/intel64_head.S
@@ -272,8 +272,8 @@ start32:
/* Jump to 64 bit initialization if this is AP core */
mov bsp_done, %eax
- cmp $0, %eax
- jne start64_init
+ test %eax, %eax
+ jnz start64_init
/* initialize rest of the page directory */
lea g_pd_low, %edi
@@ -383,8 +383,8 @@ start64:
/* Start BSP or AP */
mov bsp_done, %eax
- cmp $0, %eax
- jne ap_start
+ test %eax, %eax
+ jnz ap_start
/* Properly setup RSP to idle stack */
movabs $g_idle_topstack, %rbx
@@ -502,8 +502,8 @@ __enable_sse_avx:
/* Configure XSAVE/XRSTOR for user state*/
mov $X86_XCR0_VAL, %eax
- xor %rdx, %rdx
- xor %rcx, %rcx
+ xor %edx, %edx
+ xor %ecx, %ecx
xsetbv
#else
diff --git a/arch/x86_64/src/intel64/intel64_saveusercontext.S
b/arch/x86_64/src/intel64/intel64_saveusercontext.S
index 78151d09030..3c295552a5a 100644
--- a/arch/x86_64/src/intel64/intel64_saveusercontext.S
+++ b/arch/x86_64/src/intel64/intel64_saveusercontext.S
@@ -107,10 +107,9 @@ up_saveusercontext:
#ifdef CONFIG_ARCH_HAVE_SYSCALL
/* Save CS and SS if we support syscalls */
- xor %rax, %rax
- mov %cs, %ax
+ mov %cs, %eax
movq %rax, (8*REG_CS)(%rdi)
- mov %ss, %ax
+ mov %ss, %eax
movq %rax, (8*REG_SS)(%rdi)
#endif
@@ -133,7 +132,7 @@ up_saveusercontext:
* 'ret' will remove the RIP from the top of the stack.
*/
- xor %rax, %rax
+ xor %eax, %eax
ret
.size up_saveusercontext, . - up_saveusercontext
.end
diff --git a/arch/x86_64/src/intel64/intel64_vectors.S
b/arch/x86_64/src/intel64/intel64_vectors.S
index 823b636106e..bbca40b89a3 100644
--- a/arch/x86_64/src/intel64/intel64_vectors.S
+++ b/arch/x86_64/src/intel64/intel64_vectors.S
@@ -767,14 +767,13 @@ irq_common:
movq %rbp, (8*REG_RBP)(%rdi)
movq %rbx, (8*REG_RBX)(%rdi)
- xor %rax, %rax /* Reset rax */
- mov %ds, %ax /* Lower 16-bits of rax. */
+ mov %ds, %eax /* Lower 16-bits of rax. */
movq %rax, (8*REG_DS)(%rdi) /* Save the data segment descriptor */
- mov %es, %ax /* Lower 16-bits of rax. */
+ mov %es, %eax /* Lower 16-bits of rax. */
movq %rax, (8*REG_ES)(%rdi) /* Save the data segment descriptor */
- mov %gs, %ax /* Lower 16-bits of rax. */
+ mov %gs, %eax /* Lower 16-bits of rax. */
movq %rax, (8*REG_GS)(%rdi) /* Save the data segment descriptor */
- mov %fs, %ax /* Lower 16-bits of rax. */
+ mov %fs, %eax /* Lower 16-bits of rax. */
movq %rax, (8*REG_FS)(%rdi) /* Save the data segment descriptor */
#ifdef CONFIG_SCHED_THREAD_LOCAL