From 4e648c1693745f16fa3be40fa721bd9434618293 Mon Sep 17 00:00:00 2001 From: zhangyu117 Date: Wed, 20 May 2026 20:07:53 +0800 Subject: [PATCH] tricore/fpu: Support tricore fpucmp for float. Implement up_fpucmp to compare FPU register state between two saved contexts. This is used by the ostest FPU test to verify that FPU registers are properly preserved across context switches. Signed-off-by: zhangyu117 --- arch/tricore/src/common/tricore_fpu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/tricore/src/common/tricore_fpu.c b/arch/tricore/src/common/tricore_fpu.c index 6a28a6eaf91..ac811bbe0e6 100644 --- a/arch/tricore/src/common/tricore_fpu.c +++ b/arch/tricore/src/common/tricore_fpu.c @@ -26,6 +26,8 @@ #include +#include + #include "tricore_internal.h" /**************************************************************************** @@ -43,3 +45,16 @@ void tricore_fpuinit(void) __mtcr(FPU_SYNC_TRAP_REG, __mfcr(FPU_SYNC_TRAP_REG) | (1U << FPU_TRAP_FZE_SHIFT)); } + +/**************************************************************************** + * Name: up_fpucmp + ****************************************************************************/ + +bool up_fpucmp(const void *saveregs1, const void *saveregs2) +{ + const uintptr_t *regs1 = saveregs1; + const uintptr_t *regs2 = saveregs2; + + return memcmp(®s1[REG_D8], ®s2[REG_D8], + 8 * sizeof(uintptr_t)) == 0; +}