From: Mateja Marjanovic <Mateja.Marjanovic@rt-rk.com>
Unsigned element copy from MSA registers to GPR when
executed on a MIPS big endian CPU, didn't pick the
right element, and was behaving like on little endian.
Signed-off-by: Mateja Marjanovic <mateja.marjanovic@rt-rk.com>
---
target/mips/msa_helper.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/target/mips/msa_helper.c b/target/mips/msa_helper.c
index 012f373..8caf186 100644
--- a/target/mips/msa_helper.c
+++ b/target/mips/msa_helper.c
@@ -1467,6 +1467,13 @@ void helper_msa_copy_u_df(CPUMIPSState *env, uint32_t df, uint32_t rd,
uint32_t ws, uint32_t n)
{
n %= DF_ELEMENTS(df);
+#if defined(HOST_WORDS_BIGENDIAN)
+ if (n < DF_ELEMENTS(df) / 2) {
+ n = DF_ELEMENTS(df) / 2 - n - 1;
+ } else {
+ n = 3 * DF_ELEMENTS(df) / 2 - n - 1;
+ }
+#endif
switch (df) {
case DF_BYTE:
--
2.7.4