Skip to contentSkip to conversation

target-mips improvements

PATCH Superseded Richard Henderson 1 participant 4 messages Dec 17, 2011 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover target-mips improvements

I was interested in testing some Loongson vectorization code for GCC. These, plus a handfull of other hacks on top of Khansa Butt's mips64-linux-user patches, does a fair job of it.

I'll post the hacks under separate cover, as I don't know what the real fix ought to be; I just forced the cpu flags to be the way I needed.

r~

Richard Henderson (3):
target-mips: Streamline indexed cp1 memory addressing.
mips-linux-user: Always support rdhwr.
target-mips: Implement Loongson Multimedia Instructions

 Makefile.target          |    3 +
 target-mips/helper.h     |   59 ++++
 target-mips/lmi_helper.c |  744 ++++++++++++++++++++++++++++++++++++++++++++++
 target-mips/translate.c  |  379 +++++++++++++++++++++++-
 4 files changed, 1181 insertions(+), 4 deletions(-)
 create mode 100644 target-mips/lmi_helper.c
Signature · 1 line
1.7.7.4
#1 lore raw

PATCH 1/3 target-mips: Streamline indexed cp1 memory addressing.

We've already eliminated both base and index being zero.

---
 target-mips/translate.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
target-mips/translate.c +1 -2
index d5b1c76..b20a817 100644
@@ -7749,8 +7749,7 @@ static void gen_flt3_ldst (DisasContext *ctx, uint32_t opc,
     } else if (index == 0) {
         gen_load_gpr(t0, base);
     } else {
-        gen_load_gpr(t0, index);
-        gen_op_addr_add(ctx, t0, cpu_gpr[base], t0);
+        gen_op_addr_add(ctx, t0, cpu_gpr[base], cpu_gpr[index]);
     }
     /* Don't do NOP if destination is zero: we must perform the actual
        memory access. */
Signature · 1 line
1.7.7.4
#2 lore raw

PATCH 2/3 mips-linux-user: Always support rdhwr.

In reply to Richard Henderson

The kernel will emulate this instruction if it's not supported natively. This insn is used for TLS, among other things, and so is required by modern glibc.

---
 target-mips/translate.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
target-mips/translate.c +4 -0
index b20a817..e2ee763 100644
@@ -8118,7 +8118,11 @@ gen_rdhwr (CPUState *env, DisasContext *ctx, int rt, int rd)
 {
     TCGv t0;
 
+#if !defined(CONFIG_USER_ONLY)
+    /* The Linux kernel will emulate rdhwr if it's not supported natively.
+       Therefore only check the ISA in system mode.  */
     check_insn(env, ctx, ISA_MIPS32R2);
+#endif
     t0 = tcg_temp_new();
 
     switch (rd) {
Signature · 1 line
1.7.7.4
#3 lore raw

PATCH 3/3 target-mips: Implement Loongson Multimedia Instructions

In reply to Richard Henderson

Implements all of the COP2 instructions except for the S<cond> family of comparisons. The documentation is unclear for those.

---
 Makefile.target          |    3 +
 target-mips/helper.h     |   59 ++++
 target-mips/lmi_helper.c |  744 ++++++++++++++++++++++++++++++++++++++++++++++
 target-mips/translate.c  |  372 +++++++++++++++++++++++-
 4 files changed, 1176 insertions(+), 2 deletions(-)
 create mode 100644 target-mips/lmi_helper.c
Makefile.target +3 -0
index 8be9b9a..280af79 100644
@@ -84,6 +84,9 @@ libobj-y += cpu_init.o
 endif
 libobj-$(TARGET_SPARC) += int32_helper.o
 libobj-$(TARGET_SPARC64) += int64_helper.o
+ifeq ($(TARGET_BASE_ARCH), mips)
+libobj-y += lmi_helper.o
+endif
 
 libobj-y += disas.o
 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
target-mips/helper.h +59 -0

63 lines not on this page · raw message

target-mips/lmi_helper.c new file +744 -0

744 lines not on this page · raw message

target-mips/translate.c +370 -2

393 lines not on this page · raw message

Signature · 1 line
1.7.7.4