lightning
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/6] ppc: Add endianness check to _truncr_d_i


From: Kim Kuparinen
Subject: [PATCH 4/6] ppc: Add endianness check to _truncr_d_i
Date: Sat, 20 Nov 2021 13:13:25 +0200

When running on ppc64el, _trunc_d_i loads the upper four bytes of the truncated
value instead of the lower bytes, causing make check to fail.

Signed-off-by: Kim Kuparinen <kimi.h.kuparinen@gmail.com>
---
 lib/jit_ppc-fpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/jit_ppc-fpu.c b/lib/jit_ppc-fpu.c
index 1e84f8e..e954f48 100644
--- a/lib/jit_ppc-fpu.c
+++ b/lib/jit_ppc-fpu.c
@@ -511,7 +511,11 @@ _truncr_d_i(jit_state_t *_jit, jit_int32_t r0, jit_int32_t 
r1)
     FCTIWZ(rn(reg), r1);
     /* use reserved 8 bytes area */
     stxi_d(alloca_offset - 8, _FP_REGNO, rn(reg));
+#  if defined(__ORDER_BIG_ENDIAN)
     ldxi_i(r0, _FP_REGNO, alloca_offset - 4);
+#  else
+    ldxi_i(r0, _FP_REGNO, alloca_offset - 8);
+#  endif
     jit_unget_reg(reg);
 }
 
-- 
2.33.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]