From a4f2f191bd4a161e35223002afda733b87116716 Mon Sep 17 00:00:00 2001 From: Victor Campos Date: Thu, 13 Feb 2025 17:00:15 +0000 Subject: [PATCH] [compiler-rt] Add support for big endian for Arm's __negdf2vfp In soft floating-point ABI, this function takes the double argument as a pair of registers r0 and r1. The ordering of these two registers follow the endianness rules, therefore the register on which the bit flipping must happen depends on the endianness. --- compiler-rt/lib/builtins/arm/negdf2vfp.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/builtins/arm/negdf2vfp.S b/compiler-rt/lib/builtins/arm/negdf2vfp.S index b7cf91877e38c..329c6de757f68 100644 --- a/compiler-rt/lib/builtins/arm/negdf2vfp.S +++ b/compiler-rt/lib/builtins/arm/negdf2vfp.S @@ -20,7 +20,11 @@ DEFINE_COMPILERRT_FUNCTION(__negdf2vfp) #if defined(COMPILER_RT_ARMHF_TARGET) vneg.f64 d0, d0 #else - eor r1, r1, #-2147483648 // flip sign bit on double in r0/r1 pair +#if _YUGA_BIG_ENDIAN + eor r0, r0, #0x80000000 // flip sign bit on double in r0/r1 pair +#else + eor r1, r1, #0x80000000 // flip sign bit on double in r0/r1 pair +#endif #endif bx lr END_COMPILERRT_FUNCTION(__negdf2vfp)