[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] ppc: Add endianness check to _truncr_d_i
From: |
Kimplul |
Subject: |
[PATCH 3/3] ppc: Add endianness check to _truncr_d_i |
Date: |
Thu, 18 Nov 2021 14:53:41 +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.
---
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