diff mbox series

[RFC,04/13] tests/tcg/mips: enable mips32-dsp/mips32-dspr2/mipsr5900 linux-user (WIP)

Message ID 20181210152829.29271-5-alex.bennee@linaro.org
State New
Headers show
Series Enabling tcg/tests for xtensa, mips and cris | expand

Commit Message

Alex Bennée Dec. 10, 2018, 3:28 p.m. UTC
Convert the existing tests to use our common cross build
infrastructure.

[WIP: mips32r2 disabled to avoid name clash]
[WIP: mipsr5900 disabled due to clashing build flags]

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 tests/tcg/mips/Makefile.target       |  15 ++-
 tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------
 tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------
 tests/tcg/mips/mipsr5900/Makefile    |  40 +++----
 4 files changed, 75 insertions(+), 229 deletions(-)

-- 
2.17.1

Comments

Aleksandar Markovic Dec. 11, 2018, 9:54 a.m. UTC | #1
On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:
>

> Convert the existing tests to use our common cross build

> infrastructure.

>

> [WIP: mips32r2 disabled to avoid name clash]

> [WIP: mipsr5900 disabled due to clashing build flags]

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/tcg/mips/Makefile.target       |  15 ++-

>  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

>  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

>  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

>  4 files changed, 75 insertions(+), 229 deletions(-)

>


Thank you Alex for this initiative.

For DSP, following MIPS CPUs in QEMU support DSP:

DSP: 24KEc (MIPS32R2),  34Kf (MIPS32R2), 74Kf (MIPS32R2), mips64dspr2
(MIPS64R2),

DSP R2: mips64dspr2 (MIPS64R2),

(For simplicity, I didn't mention new nanoMIPS architecture, since your gcc
for sure don't support it yet)

In brackets, those are architectures that are usually required to be passed
to gcc as its option, and that explains the switch involving MIPS64R2 for
DSP R2.

Whereas while starting QEMU, CPU name should be specified in -cpu switch.

mips64dspr2 is a virtual cpu (doesn't model any real cpu) made specifically
for DSP R2 testings, hence such odd name.

Hopefully this clarifies some of your dilemmas.

What are name clashes that you mention? Are they just related to filenames?

CHEERS,
Aleksandar

> diff --git a/tests/tcg/mips/Makefile.target

b/tests/tcg/mips/Makefile.target
> index 086625f533..33bb25bf8d 100644

> --- a/tests/tcg/mips/Makefile.target

> +++ b/tests/tcg/mips/Makefile.target

> @@ -15,8 +15,17 @@ TESTS += $(MIPS_TESTS)

>  hello-mips: CFLAGS+=-ffreestanding

>  hello-mips: LDFLAGS+=-nostdlib

>

> -# For MIPS32 and 64 we have a bunch of extra tests in sub-directories

> -# however they are intended for system tests.

> -

>  run-hello-mips: hello-mips

>         $(call skip-test, $<, "BROKEN")

> +

> +# For MIPS32 and mipsr5900 we have a bunch of extra tests in

sub-directories
> +

> +ifeq ($(TARGET_NAME),mipsel)

> +-include $(MIPS_SRC)/mips32-dsp/Makefile

> +

> +# FIXME: doesn't build - names clash with mips32-dsp

> +#-include $(MIPS_SRC)/mips32-dspr2/Makefile

> +

> +# FIXME: the docker compiler can't build the binaries

> +#-include $(MIPS_SRC)/mipsr5900/Makefile

> +endif

> diff --git a/tests/tcg/mips/mips32-dsp/Makefile

b/tests/tcg/mips/mips32-dsp/Makefile
> index c3a0a00944..df2dddceaa 100644

> --- a/tests/tcg/mips/mips32-dsp/Makefile

> +++ b/tests/tcg/mips/mips32-dsp/Makefile

> @@ -1,136 +1,30 @@

> --include ../../config-host.mak

> -

> -CROSS=mips64el-unknown-linux-gnu-

> -

> -SIM=qemu-mipsel

> -SIM_FLAGS=-cpu 74Kf

> -

> -CC      = $(CROSS)gcc

> -CFLAGS  = -mabi=32 -march=mips32r2 -mgp32 -mdsp -static

> -

> -TESTCASES = absq_s_ph.tst

> -TESTCASES += absq_s_w.tst

> -TESTCASES += addq_ph.tst

> -TESTCASES += addq_s_ph.tst

> -TESTCASES += addq_s_w.tst

> -TESTCASES += addsc.tst

> -TESTCASES += addu_qb.tst

> -TESTCASES += addu_s_qb.tst

> -TESTCASES += addwc.tst

> -TESTCASES += bitrev.tst

> -TESTCASES += bposge32.tst

> -TESTCASES += cmp_eq_ph.tst

> -TESTCASES += cmpgu_eq_qb.tst

> -TESTCASES += cmpgu_le_qb.tst

> -TESTCASES += cmpgu_lt_qb.tst

> -TESTCASES += cmp_le_ph.tst

> -TESTCASES += cmp_lt_ph.tst

> -TESTCASES += cmpu_eq_qb.tst

> -TESTCASES += cmpu_le_qb.tst

> -TESTCASES += cmpu_lt_qb.tst

> -TESTCASES += dpaq_sa_l_w.tst

> -TESTCASES += dpaq_s_w_ph.tst

> -TESTCASES += dpau_h_qbl.tst

> -TESTCASES += dpau_h_qbr.tst

> -TESTCASES += dpsq_sa_l_w.tst

> -TESTCASES += dpsq_s_w_ph.tst

> -TESTCASES += dpsu_h_qbl.tst

> -TESTCASES += dpsu_h_qbr.tst

> -TESTCASES += extp.tst

> -TESTCASES += extpdp.tst

> -TESTCASES += extpdpv.tst

> -TESTCASES += extpv.tst

> -TESTCASES += extr_rs_w.tst

> -TESTCASES += extr_r_w.tst

> -TESTCASES += extr_s_h.tst

> -TESTCASES += extrv_rs_w.tst

> -TESTCASES += extrv_r_w.tst

> -TESTCASES += extrv_s_h.tst

> -TESTCASES += extrv_w.tst

> -TESTCASES += extr_w.tst

> -TESTCASES += insv.tst

> -TESTCASES += lbux.tst

> -TESTCASES += lhx.tst

> -TESTCASES += lwx.tst

> -TESTCASES += madd.tst

> -TESTCASES += maddu.tst

> -TESTCASES += maq_sa_w_phl.tst

> -TESTCASES += maq_sa_w_phr.tst

> -TESTCASES += maq_s_w_phl.tst

> -TESTCASES += maq_s_w_phr.tst

> -TESTCASES += mfhi.tst

> -TESTCASES += mflo.tst

> -TESTCASES += modsub.tst

> -TESTCASES += msub.tst

> -TESTCASES += msubu.tst

> -TESTCASES += mthi.tst

> -TESTCASES += mthlip.tst

> -TESTCASES += mtlo.tst

> -TESTCASES += muleq_s_w_phl.tst

> -TESTCASES += muleq_s_w_phr.tst

> -TESTCASES += muleu_s_ph_qbl.tst

> -TESTCASES += muleu_s_ph_qbr.tst

> -TESTCASES += mulq_rs_ph.tst

> -TESTCASES += mult.tst

> -TESTCASES += multu.tst

> -TESTCASES += packrl_ph.tst

> -TESTCASES += pick_ph.tst

> -TESTCASES += pick_qb.tst

> -TESTCASES += precequ_ph_qbla.tst

> -TESTCASES += precequ_ph_qbl.tst

> -TESTCASES += precequ_ph_qbra.tst

> -TESTCASES += precequ_ph_qbr.tst

> -TESTCASES += preceq_w_phl.tst

> -TESTCASES += preceq_w_phr.tst

> -TESTCASES += preceu_ph_qbla.tst

> -TESTCASES += preceu_ph_qbl.tst

> -TESTCASES += preceu_ph_qbra.tst

> -TESTCASES += preceu_ph_qbr.tst

> -TESTCASES += precrq_ph_w.tst

> -TESTCASES += precrq_qb_ph.tst

> -TESTCASES += precrq_rs_ph_w.tst

> -TESTCASES += precrqu_s_qb_ph.tst

> -TESTCASES += raddu_w_qb.tst

> -TESTCASES += rddsp.tst

> -TESTCASES += repl_ph.tst

> -TESTCASES += repl_qb.tst

> -TESTCASES += replv_ph.tst

> -TESTCASES += replv_qb.tst

> -TESTCASES += shilo.tst

> -TESTCASES += shilov.tst

> -TESTCASES += shll_ph.tst

> -TESTCASES += shll_qb.tst

> -TESTCASES += shll_s_ph.tst

> -TESTCASES += shll_s_w.tst

> -TESTCASES += shllv_ph.tst

> -TESTCASES += shllv_qb.tst

> -TESTCASES += shllv_s_ph.tst

> -TESTCASES += shllv_s_w.tst

> -TESTCASES += shra_ph.tst

> -TESTCASES += shra_r_ph.tst

> -TESTCASES += shra_r_w.tst

> -TESTCASES += shrav_ph.tst

> -TESTCASES += shrav_r_ph.tst

> -TESTCASES += shrav_r_w.tst

> -TESTCASES += shrl_qb.tst

> -TESTCASES += shrlv_qb.tst

> -TESTCASES += subq_ph.tst

> -TESTCASES += subq_s_ph.tst

> -TESTCASES += subq_s_w.tst

> -TESTCASES += subu_qb.tst

> -TESTCASES += subu_s_qb.tst

> -TESTCASES += wrdsp.tst

> -

> -all: $(TESTCASES)

> -

> -%.tst: %.c

> -       $(CC) $(CFLAGS) $< -o $@

> -

> -check: $(TESTCASES)

> -       @for case in $(TESTCASES); do \

> -        echo $(SIM) $(SIM_FLAGS) ./$$case;\

> -        $(SIM) $(SIM_FLAGS) ./$$case; \

> -       done

> -

> -clean:

> -       $(RM) -rf $(TESTCASES)

> +#

> +# MIPS32-DSP linux-user tests

> +#

> +# We don't set the VPATH for these tests as we re-use the VPATH from

> +# ../Makefile and add explicit paths for the source to avoid name clashes

> +# between the various sub-dirs.

> +#

> +

> +MIPS32DSP_SRC = $(SRC_PATH)/tests/tcg/mips/mips32-dsp

> +MIPS32DSP_ALL = $(wildcard $(MIPS32DSP_SRC)/*.c)

> +MIPS32DSP_TESTS = $(patsubst $(MIPS32DSP_SRC)/%.c, mips32-dsp/%,

$(MIPS32DSP_ALL))
> +MIPS32DSP_RUNS = $(patsubst %, run-%, $(MIPS32DSP_TESTS))

> +

> +# add to the list of tests

> +TESTS += $(MIPS32DSP_TESTS)

> +

> +# We need a rule to ensure we create a sub-directory to build in

> +# It is a PHONY target to prevent confusion with MIPS32DSP_SRC

> +.PHONY: mips32-dsp.build

> +mips32-dsp.build:

> +       mkdir -p mips32-dsp

> +

> +$(MIPS32DSP_TESTS): | mips32-dsp.build

> +$(MIPS32DSP_TESTS): CFLAGS+=-mabi=32 -march=mips32r2 -mgp32 -mdsp

> +

> +$(MIPS32DSP_RUNS): QEMU_OPTS=-cpu 74Kf

> +

> +# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't

enough
> +run-mips32-dsp/%: mips32-dsp/%

> +       $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on

$(TARGET_NAME) $(QEMU_OPTS)")
> diff --git a/tests/tcg/mips/mips32-dspr2/Makefile

b/tests/tcg/mips/mips32-dspr2/Makefile
> index ed19581c7e..6da966abb6 100644

> --- a/tests/tcg/mips/mips32-dspr2/Makefile

> +++ b/tests/tcg/mips/mips32-dspr2/Makefile

> @@ -1,71 +1,24 @@

> --include ../../config-host.mak

> +#

> +# MIPS32-DSPR2 linux-user tests

> +#

>

> -CROSS=mips64el-unknown-linux-gnu-

> +MIPS32_DSPR2_SRC = $(SRC_PATH)/tests/tcg/mips/mips32-dsp

> +MIPS32_DSPR2_ALL = $(wildcard $(MIPS32_DSPR2_SRC)/*.c)

> +MIPS32_DSPR2_TESTS = $(patsubst $(MIPS32_DSPR2_SRC)/%.c, mips32-dspr2/%,

$(MIPS32_DSPR2_ALL))
> +MIPS32_DSPR2_RUNS = $(patsubst %, run-%, $(MIPS32_DSPR2_TESTS))

>

> -SIM=qemu-mipsel

> -SIM_FLAGS=-cpu 74Kf

> +# add to the list of tests

> +TESTS += $(MIPS32_DSPR2_TESTS)

>

> -CC      = $(CROSS)gcc

> -CFLAGS  = -mabi=32 -march=mips32r2 -mgp32 -mdspr2 -static

> +.PHONY: mips32-dspr2.build

> +mips32-dspr2.build:

> +       mkdir -p mips32-dspr2

>

> -TESTCASES = absq_s_qb.tst

> -TESTCASES += addqh_ph.tst

> -TESTCASES += addqh_r_ph.tst

> -TESTCASES += addqh_r_w.tst

> -TESTCASES += addqh_w.tst

> -TESTCASES += adduh_qb.tst

> -TESTCASES += adduh_r_qb.tst

> -TESTCASES += addu_ph.tst

> -TESTCASES += addu_s_ph.tst

> -TESTCASES += append.tst

> -TESTCASES += balign.tst

> -TESTCASES += cmpgdu_eq_qb.tst

> -TESTCASES += cmpgdu_le_qb.tst

> -TESTCASES += cmpgdu_lt_qb.tst

> -TESTCASES += dpaqx_sa_w_ph.tst

> -TESTCASES += dpa_w_ph.tst

> -TESTCASES += dpax_w_ph.tst

> -TESTCASES += dpaqx_s_w_ph.tst

> -TESTCASES += dpsqx_sa_w_ph.tst

> -TESTCASES += dpsqx_s_w_ph.tst

> -TESTCASES += dps_w_ph.tst

> -TESTCASES += dpsx_w_ph.tst

> -TESTCASES += mul_ph.tst

> -TESTCASES += mulq_rs_w.tst

> -TESTCASES += mulq_s_ph.tst

> -TESTCASES += mulq_s_w.tst

> -TESTCASES += mulsaq_s_w_ph.tst

> -TESTCASES += mulsa_w_ph.tst

> -TESTCASES += mul_s_ph.tst

> -TESTCASES += precr_qb_ph.tst

> -TESTCASES += precr_sra_ph_w.tst

> -TESTCASES += precr_sra_r_ph_w.tst

> -TESTCASES += prepend.tst

> -TESTCASES += shra_qb.tst

> -TESTCASES += shra_r_qb.tst

> -TESTCASES += shrav_qb.tst

> -TESTCASES += shrav_r_qb.tst

> -TESTCASES += shrl_ph.tst

> -TESTCASES += shrlv_ph.tst

> -TESTCASES += subqh_ph.tst

> -TESTCASES += subqh_r_ph.tst

> -TESTCASES += subqh_r_w.tst

> -TESTCASES += subqh_w.tst

> -TESTCASES += subuh_qb.tst

> -TESTCASES += subuh_r_qb.tst

> -TESTCASES += subu_ph.tst

> -TESTCASES += subu_s_ph.tst

> +$(MIPS32_DSPR2_TESTS): | mips32-dspr2.build

> +$(MIPS32_DSPR2_TESTS): CFLAGS+=-mabi=32 -march=mips32r2 -mgp32 -mdspr2

>

> -all: $(TESTCASES)

> +$(MIPS32_DSPR2_RUNS): QEMU_OPTS=-cpu 74Kf

>

> -%.tst: %.c

> -       $(CC) $(CFLAGS) $< -o $@

> -

> -check: $(TESTCASES)

> -       @for case in $(TESTCASES); do \

> -        echo $(SIM) $(SIM_FLAGS) ./$$case;\

> -               $(SIM) $(SIM_FLAGS) ./$$case; \

> -       done

> -

> -clean:

> -       $(RM) -rf $(TESTCASES)

> +# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't

enough
> +run-mips32-dspr2/%: mips32-dspr2/%

> +       $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on

$(TARGET_NAME) $(QEMU_OPTS)")
> diff --git a/tests/tcg/mips/mipsr5900/Makefile

b/tests/tcg/mips/mipsr5900/Makefile
> index a1c388bc3c..7880e76986 100644

> --- a/tests/tcg/mips/mipsr5900/Makefile

> +++ b/tests/tcg/mips/mipsr5900/Makefile

> @@ -1,30 +1,20 @@

> --include ../../config-host.mak

> +#

> +# MIPSR5900 linux-user tests

> +#

>

> -CROSS=mipsr5900el-unknown-linux-gnu-

> +MIPSR5900_SRC = $(SRC_PATH)/tests/tcg/mips/mipsr5900

> +MIPSR5900_ALL = $(wildcard $(MIPSR5900_SRC)/*.c)

> +MIPSR5900_TESTS = $(patsubst $(MIPSR5900_SRC)/%.c, %, $(MIPSR5900_ALL))

> +MIPSR5900_RUNS = $(patsubst %, run-%, $(MIPSR5900_TESTS))

>

> -SIM=qemu-mipsel

> -SIM_FLAGS=-cpu R5900

> +# add to the list of tests

> +TESTS += $(MIPSR5900_TESTS)

>

> -CC      = $(CROSS)gcc

> -CFLAGS  = -Wall -mabi=32 -march=r5900 -static

> +.PHONY: mipsr5900.build

> +mipsr5900.build:

> +       mkdir -p mipsr5900

>

> -TESTCASES = div1.tst

> -TESTCASES += divu1.tst

> -TESTCASES += mflohi1.tst

> -TESTCASES += mtlohi1.tst

> -TESTCASES += mult.tst

> -TESTCASES += multu.tst

> +$(MIPS32DSP_TESTS): | mipsr5900.build

> +$(MIPSR5900_TESTS): CFLAGS+=-mabi=32 -march=r5900 -msingle-float

>

> -all: $(TESTCASES)

> -

> -%.tst: %.c

> -       $(CC) $(CFLAGS) $< -o $@

> -

> -check: $(TESTCASES)

> -       @for case in $(TESTCASES); do \

> -        echo $(SIM) $(SIM_FLAGS) ./$$case;\

> -        $(SIM) $(SIM_FLAGS) ./$$case; \

> -       done

> -

> -clean:

> -       $(RM) -rf $(TESTCASES)

> +$(MIPSR5900_RUNS): QEMU_OPTS=-cpu R5900

> --

> 2.17.1

>

>
Aleksandar Markovic Dec. 11, 2018, 10:16 a.m. UTC | #2
On Dec 11, 2018 10:54 AM, "Aleksandar Markovic" <aleksandar.m.mail@gmail.com>
wrote:
>

>

> On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:

> >

> > Convert the existing tests to use our common cross build

> > infrastructure.

> >

> > [WIP: mips32r2 disabled to avoid name clash]

> > [WIP: mipsr5900 disabled due to clashing build flags]

> >

> > Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> > ---

> >  tests/tcg/mips/Makefile.target       |  15 ++-

> >  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

> >  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

> >  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

> >  4 files changed, 75 insertions(+), 229 deletions(-)

> >

>

> Thank you Alex for this initiative.

>

> For DSP, following MIPS CPUs in QEMU support DSP:

>

> DSP: 24KEc (MIPS32R2),  34Kf (MIPS32R2), 74Kf (MIPS32R2), mips64dspr2

(MIPS64R2),
>

> DSP R2: mips64dspr2 (MIPS64R2),

>


Correction: 74Kf supports DSP R2 too. So this is the only MIPS32R2 cpu with
DSP R2 support. While mips64dspr2 is the only MIPS64R2 cpu with DSP R2
support.

> (For simplicity, I didn't mention new nanoMIPS architecture, since your

gcc for sure don't support it yet)
>

> In brackets, those are architectures that are usually required to be

passed to gcc as its option, and that explains the switch involving
MIPS64R2 for DSP R2.
>

> Whereas while starting QEMU, CPU name should be specified in -cpu switch.

>

> mips64dspr2 is a virtual cpu (doesn't model any real cpu) made

specifically for DSP R2 testings, hence such odd name.
>

> Hopefully this clarifies some of your dilemmas.

>

> What are name clashes that you mention? Are they just related to

filenames?
>

> CHEERS,

> Aleksandar

>

> > diff --git a/tests/tcg/mips/Makefile.target

b/tests/tcg/mips/Makefile.target
> > index 086625f533..33bb25bf8d 100644

> > --- a/tests/tcg/mips/Makefile.target

> > +++ b/tests/tcg/mips/Makefile.target

> > @@ -15,8 +15,17 @@ TESTS += $(MIPS_TESTS)

> >  hello-mips: CFLAGS+=-ffreestanding

> >  hello-mips: LDFLAGS+=-nostdlib

> >

> > -# For MIPS32 and 64 we have a bunch of extra tests in sub-directories

> > -# however they are intended for system tests.

> > -

> >  run-hello-mips: hello-mips

> >         $(call skip-test, $<, "BROKEN")

> > +

> > +# For MIPS32 and mipsr5900 we have a bunch of extra tests in

sub-directories
> > +

> > +ifeq ($(TARGET_NAME),mipsel)

> > +-include $(MIPS_SRC)/mips32-dsp/Makefile

> > +

> > +# FIXME: doesn't build - names clash with mips32-dsp

> > +#-include $(MIPS_SRC)/mips32-dspr2/Makefile

> > +

> > +# FIXME: the docker compiler can't build the binaries

> > +#-include $(MIPS_SRC)/mipsr5900/Makefile

> > +endif

> > diff --git a/tests/tcg/mips/mips32-dsp/Makefile

b/tests/tcg/mips/mips32-dsp/Makefile
> > index c3a0a00944..df2dddceaa 100644

> > --- a/tests/tcg/mips/mips32-dsp/Makefile

> > +++ b/tests/tcg/mips/mips32-dsp/Makefile

> > @@ -1,136 +1,30 @@

> > --include ../../config-host.mak

> > -

> > -CROSS=mips64el-unknown-linux-gnu-

> > -

> > -SIM=qemu-mipsel

> > -SIM_FLAGS=-cpu 74Kf

> > -

> > -CC      = $(CROSS)gcc

> > -CFLAGS  = -mabi=32 -march=mips32r2 -mgp32 -mdsp -static

> > -

> > -TESTCASES = absq_s_ph.tst

> > -TESTCASES += absq_s_w.tst

> > -TESTCASES += addq_ph.tst

> > -TESTCASES += addq_s_ph.tst

> > -TESTCASES += addq_s_w.tst

> > -TESTCASES += addsc.tst

> > -TESTCASES += addu_qb.tst

> > -TESTCASES += addu_s_qb.tst

> > -TESTCASES += addwc.tst

> > -TESTCASES += bitrev.tst

> > -TESTCASES += bposge32.tst

> > -TESTCASES += cmp_eq_ph.tst

> > -TESTCASES += cmpgu_eq_qb.tst

> > -TESTCASES += cmpgu_le_qb.tst

> > -TESTCASES += cmpgu_lt_qb.tst

> > -TESTCASES += cmp_le_ph.tst

> > -TESTCASES += cmp_lt_ph.tst

> > -TESTCASES += cmpu_eq_qb.tst

> > -TESTCASES += cmpu_le_qb.tst

> > -TESTCASES += cmpu_lt_qb.tst

> > -TESTCASES += dpaq_sa_l_w.tst

> > -TESTCASES += dpaq_s_w_ph.tst

> > -TESTCASES += dpau_h_qbl.tst

> > -TESTCASES += dpau_h_qbr.tst

> > -TESTCASES += dpsq_sa_l_w.tst

> > -TESTCASES += dpsq_s_w_ph.tst

> > -TESTCASES += dpsu_h_qbl.tst

> > -TESTCASES += dpsu_h_qbr.tst

> > -TESTCASES += extp.tst

> > -TESTCASES += extpdp.tst

> > -TESTCASES += extpdpv.tst

> > -TESTCASES += extpv.tst

> > -TESTCASES += extr_rs_w.tst

> > -TESTCASES += extr_r_w.tst

> > -TESTCASES += extr_s_h.tst

> > -TESTCASES += extrv_rs_w.tst

> > -TESTCASES += extrv_r_w.tst

> > -TESTCASES += extrv_s_h.tst

> > -TESTCASES += extrv_w.tst

> > -TESTCASES += extr_w.tst

> > -TESTCASES += insv.tst

> > -TESTCASES += lbux.tst

> > -TESTCASES += lhx.tst

> > -TESTCASES += lwx.tst

> > -TESTCASES += madd.tst

> > -TESTCASES += maddu.tst

> > -TESTCASES += maq_sa_w_phl.tst

> > -TESTCASES += maq_sa_w_phr.tst

> > -TESTCASES += maq_s_w_phl.tst

> > -TESTCASES += maq_s_w_phr.tst

> > -TESTCASES += mfhi.tst

> > -TESTCASES += mflo.tst

> > -TESTCASES += modsub.tst

> > -TESTCASES += msub.tst

> > -TESTCASES += msubu.tst

> > -TESTCASES += mthi.tst

> > -TESTCASES += mthlip.tst

> > -TESTCASES += mtlo.tst

> > -TESTCASES += muleq_s_w_phl.tst

> > -TESTCASES += muleq_s_w_phr.tst

> > -TESTCASES += muleu_s_ph_qbl.tst

> > -TESTCASES += muleu_s_ph_qbr.tst

> > -TESTCASES += mulq_rs_ph.tst

> > -TESTCASES += mult.tst

> > -TESTCASES += multu.tst

> > -TESTCASES += packrl_ph.tst

> > -TESTCASES += pick_ph.tst

> > -TESTCASES += pick_qb.tst

> > -TESTCASES += precequ_ph_qbla.tst

> > -TESTCASES += precequ_ph_qbl.tst

> > -TESTCASES += precequ_ph_qbra.tst

> > -TESTCASES += precequ_ph_qbr.tst

> > -TESTCASES += preceq_w_phl.tst

> > -TESTCASES += preceq_w_phr.tst

> > -TESTCASES += preceu_ph_qbla.tst

> > -TESTCASES += preceu_ph_qbl.tst

> > -TESTCASES += preceu_ph_qbra.tst

> > -TESTCASES += preceu_ph_qbr.tst

> > -TESTCASES += precrq_ph_w.tst

> > -TESTCASES += precrq_qb_ph.tst

> > -TESTCASES += precrq_rs_ph_w.tst

> > -TESTCASES += precrqu_s_qb_ph.tst

> > -TESTCASES += raddu_w_qb.tst

> > -TESTCASES += rddsp.tst

> > -TESTCASES += repl_ph.tst

> > -TESTCASES += repl_qb.tst

> > -TESTCASES += replv_ph.tst

> > -TESTCASES += replv_qb.tst

> > -TESTCASES += shilo.tst

> > -TESTCASES += shilov.tst

> > -TESTCASES += shll_ph.tst

> > -TESTCASES += shll_qb.tst

> > -TESTCASES += shll_s_ph.tst

> > -TESTCASES += shll_s_w.tst

> > -TESTCASES += shllv_ph.tst

> > -TESTCASES += shllv_qb.tst

> > -TESTCASES += shllv_s_ph.tst

> > -TESTCASES += shllv_s_w.tst

> > -TESTCASES += shra_ph.tst

> > -TESTCASES += shra_r_ph.tst

> > -TESTCASES += shra_r_w.tst

> > -TESTCASES += shrav_ph.tst

> > -TESTCASES += shrav_r_ph.tst

> > -TESTCASES += shrav_r_w.tst

> > -TESTCASES += shrl_qb.tst

> > -TESTCASES += shrlv_qb.tst

> > -TESTCASES += subq_ph.tst

> > -TESTCASES += subq_s_ph.tst

> > -TESTCASES += subq_s_w.tst

> > -TESTCASES += subu_qb.tst

> > -TESTCASES += subu_s_qb.tst

> > -TESTCASES += wrdsp.tst

> > -

> > -all: $(TESTCASES)

> > -

> > -%.tst: %.c

> > -       $(CC) $(CFLAGS) $< -o $@

> > -

> > -check: $(TESTCASES)

> > -       @for case in $(TESTCASES); do \

> > -        echo $(SIM) $(SIM_FLAGS) ./$$case;\

> > -        $(SIM) $(SIM_FLAGS) ./$$case; \

> > -       done

> > -

> > -clean:

> > -       $(RM) -rf $(TESTCASES)

> > +#

> > +# MIPS32-DSP linux-user tests

> > +#

> > +# We don't set the VPATH for these tests as we re-use the VPATH from

> > +# ../Makefile and add explicit paths for the source to avoid name

clashes
> > +# between the various sub-dirs.

> > +#

> > +

> > +MIPS32DSP_SRC = $(SRC_PATH)/tests/tcg/mips/mips32-dsp

> > +MIPS32DSP_ALL = $(wildcard $(MIPS32DSP_SRC)/*.c)

> > +MIPS32DSP_TESTS = $(patsubst $(MIPS32DSP_SRC)/%.c, mips32-dsp/%,

$(MIPS32DSP_ALL))
> > +MIPS32DSP_RUNS = $(patsubst %, run-%, $(MIPS32DSP_TESTS))

> > +

> > +# add to the list of tests

> > +TESTS += $(MIPS32DSP_TESTS)

> > +

> > +# We need a rule to ensure we create a sub-directory to build in

> > +# It is a PHONY target to prevent confusion with MIPS32DSP_SRC

> > +.PHONY: mips32-dsp.build

> > +mips32-dsp.build:

> > +       mkdir -p mips32-dsp

> > +

> > +$(MIPS32DSP_TESTS): | mips32-dsp.build

> > +$(MIPS32DSP_TESTS): CFLAGS+=-mabi=32 -march=mips32r2 -mgp32 -mdsp

> > +

> > +$(MIPS32DSP_RUNS): QEMU_OPTS=-cpu 74Kf

> > +

> > +# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't

enough
> > +run-mips32-dsp/%: mips32-dsp/%

> > +       $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on

$(TARGET_NAME) $(QEMU_OPTS)")
> > diff --git a/tests/tcg/mips/mips32-dspr2/Makefile

b/tests/tcg/mips/mips32-dspr2/Makefile
> > index ed19581c7e..6da966abb6 100644

> > --- a/tests/tcg/mips/mips32-dspr2/Makefile

> > +++ b/tests/tcg/mips/mips32-dspr2/Makefile

> > @@ -1,71 +1,24 @@

> > --include ../../config-host.mak

> > +#

> > +# MIPS32-DSPR2 linux-user tests

> > +#

> >

> > -CROSS=mips64el-unknown-linux-gnu-

> > +MIPS32_DSPR2_SRC = $(SRC_PATH)/tests/tcg/mips/mips32-dsp

> > +MIPS32_DSPR2_ALL = $(wildcard $(MIPS32_DSPR2_SRC)/*.c)

> > +MIPS32_DSPR2_TESTS = $(patsubst $(MIPS32_DSPR2_SRC)/%.c,

mips32-dspr2/%, $(MIPS32_DSPR2_ALL))
> > +MIPS32_DSPR2_RUNS = $(patsubst %, run-%, $(MIPS32_DSPR2_TESTS))

> >

> > -SIM=qemu-mipsel

> > -SIM_FLAGS=-cpu 74Kf

> > +# add to the list of tests

> > +TESTS += $(MIPS32_DSPR2_TESTS)

> >

> > -CC      = $(CROSS)gcc

> > -CFLAGS  = -mabi=32 -march=mips32r2 -mgp32 -mdspr2 -static

> > +.PHONY: mips32-dspr2.build

> > +mips32-dspr2.build:

> > +       mkdir -p mips32-dspr2

> >

> > -TESTCASES = absq_s_qb.tst

> > -TESTCASES += addqh_ph.tst

> > -TESTCASES += addqh_r_ph.tst

> > -TESTCASES += addqh_r_w.tst

> > -TESTCASES += addqh_w.tst

> > -TESTCASES += adduh_qb.tst

> > -TESTCASES += adduh_r_qb.tst

> > -TESTCASES += addu_ph.tst

> > -TESTCASES += addu_s_ph.tst

> > -TESTCASES += append.tst

> > -TESTCASES += balign.tst

> > -TESTCASES += cmpgdu_eq_qb.tst

> > -TESTCASES += cmpgdu_le_qb.tst

> > -TESTCASES += cmpgdu_lt_qb.tst

> > -TESTCASES += dpaqx_sa_w_ph.tst

> > -TESTCASES += dpa_w_ph.tst

> > -TESTCASES += dpax_w_ph.tst

> > -TESTCASES += dpaqx_s_w_ph.tst

> > -TESTCASES += dpsqx_sa_w_ph.tst

> > -TESTCASES += dpsqx_s_w_ph.tst

> > -TESTCASES += dps_w_ph.tst

> > -TESTCASES += dpsx_w_ph.tst

> > -TESTCASES += mul_ph.tst

> > -TESTCASES += mulq_rs_w.tst

> > -TESTCASES += mulq_s_ph.tst

> > -TESTCASES += mulq_s_w.tst

> > -TESTCASES += mulsaq_s_w_ph.tst

> > -TESTCASES += mulsa_w_ph.tst

> > -TESTCASES += mul_s_ph.tst

> > -TESTCASES += precr_qb_ph.tst

> > -TESTCASES += precr_sra_ph_w.tst

> > -TESTCASES += precr_sra_r_ph_w.tst

> > -TESTCASES += prepend.tst

> > -TESTCASES += shra_qb.tst

> > -TESTCASES += shra_r_qb.tst

> > -TESTCASES += shrav_qb.tst

> > -TESTCASES += shrav_r_qb.tst

> > -TESTCASES += shrl_ph.tst

> > -TESTCASES += shrlv_ph.tst

> > -TESTCASES += subqh_ph.tst

> > -TESTCASES += subqh_r_ph.tst

> > -TESTCASES += subqh_r_w.tst

> > -TESTCASES += subqh_w.tst

> > -TESTCASES += subuh_qb.tst

> > -TESTCASES += subuh_r_qb.tst

> > -TESTCASES += subu_ph.tst

> > -TESTCASES += subu_s_ph.tst

> > +$(MIPS32_DSPR2_TESTS): | mips32-dspr2.build

> > +$(MIPS32_DSPR2_TESTS): CFLAGS+=-mabi=32 -march=mips32r2 -mgp32 -mdspr2

> >

> > -all: $(TESTCASES)

> > +$(MIPS32_DSPR2_RUNS): QEMU_OPTS=-cpu 74Kf

> >

> > -%.tst: %.c

> > -       $(CC) $(CFLAGS) $< -o $@

> > -

> > -check: $(TESTCASES)

> > -       @for case in $(TESTCASES); do \

> > -        echo $(SIM) $(SIM_FLAGS) ./$$case;\

> > -               $(SIM) $(SIM_FLAGS) ./$$case; \

> > -       done

> > -

> > -clean:

> > -       $(RM) -rf $(TESTCASES)

> > +# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't

enough
> > +run-mips32-dspr2/%: mips32-dspr2/%

> > +       $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on

$(TARGET_NAME) $(QEMU_OPTS)")
> > diff --git a/tests/tcg/mips/mipsr5900/Makefile

b/tests/tcg/mips/mipsr5900/Makefile
> > index a1c388bc3c..7880e76986 100644

> > --- a/tests/tcg/mips/mipsr5900/Makefile

> > +++ b/tests/tcg/mips/mipsr5900/Makefile

> > @@ -1,30 +1,20 @@

> > --include ../../config-host.mak

> > +#

> > +# MIPSR5900 linux-user tests

> > +#

> >

> > -CROSS=mipsr5900el-unknown-linux-gnu-

> > +MIPSR5900_SRC = $(SRC_PATH)/tests/tcg/mips/mipsr5900

> > +MIPSR5900_ALL = $(wildcard $(MIPSR5900_SRC)/*.c)

> > +MIPSR5900_TESTS = $(patsubst $(MIPSR5900_SRC)/%.c, %, $(MIPSR5900_ALL))

> > +MIPSR5900_RUNS = $(patsubst %, run-%, $(MIPSR5900_TESTS))

> >

> > -SIM=qemu-mipsel

> > -SIM_FLAGS=-cpu R5900

> > +# add to the list of tests

> > +TESTS += $(MIPSR5900_TESTS)

> >

> > -CC      = $(CROSS)gcc

> > -CFLAGS  = -Wall -mabi=32 -march=r5900 -static

> > +.PHONY: mipsr5900.build

> > +mipsr5900.build:

> > +       mkdir -p mipsr5900

> >

> > -TESTCASES = div1.tst

> > -TESTCASES += divu1.tst

> > -TESTCASES += mflohi1.tst

> > -TESTCASES += mtlohi1.tst

> > -TESTCASES += mult.tst

> > -TESTCASES += multu.tst

> > +$(MIPS32DSP_TESTS): | mipsr5900.build

> > +$(MIPSR5900_TESTS): CFLAGS+=-mabi=32 -march=r5900 -msingle-float

> >

> > -all: $(TESTCASES)

> > -

> > -%.tst: %.c

> > -       $(CC) $(CFLAGS) $< -o $@

> > -

> > -check: $(TESTCASES)

> > -       @for case in $(TESTCASES); do \

> > -        echo $(SIM) $(SIM_FLAGS) ./$$case;\

> > -        $(SIM) $(SIM_FLAGS) ./$$case; \

> > -       done

> > -

> > -clean:

> > -       $(RM) -rf $(TESTCASES)

> > +$(MIPSR5900_RUNS): QEMU_OPTS=-cpu R5900

> > --

> > 2.17.1

> >

> >
Alex Bennée Dec. 11, 2018, 12:17 p.m. UTC | #3
Aleksandar Markovic <aleksandar.m.mail@gmail.com> writes:

> On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:

>>

>> Convert the existing tests to use our common cross build

>> infrastructure.

>>

>> [WIP: mips32r2 disabled to avoid name clash]

>> [WIP: mipsr5900 disabled due to clashing build flags]

>>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> ---

>>  tests/tcg/mips/Makefile.target       |  15 ++-

>>  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

>>  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

>>  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

>>  4 files changed, 75 insertions(+), 229 deletions(-)

>>

>

> Thank you Alex for this initiative.

>

> For DSP, following MIPS CPUs in QEMU support DSP:

>

> DSP: 24KEc (MIPS32R2),  34Kf (MIPS32R2), 74Kf (MIPS32R2), mips64dspr2

> (MIPS64R2),

>

> DSP R2: mips64dspr2 (MIPS64R2),


That's why I'm confused by a mips32-dspr2 directory. Does that mean both
of those directories run on the 74Kf processor model (MIPS32R2)?

> (For simplicity, I didn't mention new nanoMIPS architecture, since your gcc

> for sure don't support it yet)

>

> In brackets, those are architectures that are usually required to be passed

> to gcc as its option, and that explains the switch involving MIPS64R2 for

> DSP R2.

>

> Whereas while starting QEMU, CPU name should be specified in -cpu switch.

>

> mips64dspr2 is a virtual cpu (doesn't model any real cpu) made specifically

> for DSP R2 testings, hence such odd name.

>

> Hopefully this clarifies some of your dilemmas.

>

> What are name clashes that you mention? Are they just related to

> filenames?


I think it is because there are a bunch of names in both mips32-dsp and
mips32-dspr2 that are the same. I thought that should be sorted by the
fact I only set the VPATH to tests/tcg/mips and added the tests
including their dir path but for some reason it wasn't working.

--
Alex Bennée
Richard Henderson Dec. 11, 2018, 1:45 p.m. UTC | #4
On 12/10/18 9:28 AM, Alex Bennée wrote:
> +# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't enough

> +run-mips32-dspr2/%: mips32-dspr2/%

> +	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME) $(QEMU_OPTS)")


Perhaps it's the "/"?  Otherwise I agree it doesn't make sense.


r~
Aleksandar Markovic Dec. 19, 2018, 2:39 p.m. UTC | #5
On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:
>

> Convert the existing tests to use our common cross build

> infrastructure.

>

> [WIP: mips32r2 disabled to avoid name clash]

> [WIP: mipsr5900 disabled due to clashing build flags]

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  tests/tcg/mips/Makefile.target       |  15 ++-

>  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

>  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

>  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

>  4 files changed, 75 insertions(+), 229 deletions(-)

>


Alex,

How about reorganizing directories in tests/tcg/mips altogether, and make
it less confusing, and easier for future developers to approach an work on?

Let's say like this:

tests/tcg/mips
    user
        isa
            r5900
        ase
            dsp
            dsp_r2
    system
        isa   《for now empty》
        ase
            dsp
            dsp_r2

Thanks,
Aleksandar
Alex Bennée Dec. 19, 2018, 4:03 p.m. UTC | #6
Aleksandar Markovic <aleksandar.m.mail@gmail.com> writes:

> On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:

>>

>> Convert the existing tests to use our common cross build

>> infrastructure.

>>

>> [WIP: mips32r2 disabled to avoid name clash]

>> [WIP: mipsr5900 disabled due to clashing build flags]

>>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> ---

>>  tests/tcg/mips/Makefile.target       |  15 ++-

>>  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

>>  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

>>  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

>>  4 files changed, 75 insertions(+), 229 deletions(-)

>>

>

> Alex,

>

> How about reorganizing directories in tests/tcg/mips altogether, and make

> it less confusing, and easier for future developers to approach an work on?

>

> Let's say like this:

>

> tests/tcg/mips

>     user

>         isa

>             r5900

>         ase

>             dsp

>             dsp_r2

>     system

>         isa   《for now empty》

>         ase

>             dsp

>             dsp_r2


Yeah sounds like a plan. I'm going to do the same with cris (bare and libc).

>

> Thanks,

> Aleksandar



--
Alex Bennée
Aleksandar Markovic Dec. 27, 2018, 11:22 a.m. UTC | #7
HI, Alex, just a heads up that I plan to submit directory and file
reorganization of tests/tcg/mips mini patch series today or tomorrow.
Aleksandar

On Wednesday, December 19, 2018, Alex Bennée <alex.bennee@linaro.org> wrote:

>

> Aleksandar Markovic <aleksandar.m.mail@gmail.com> writes:

>

> > On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:

> >>

> >> Convert the existing tests to use our common cross build

> >> infrastructure.

> >>

> >> [WIP: mips32r2 disabled to avoid name clash]

> >> [WIP: mipsr5900 disabled due to clashing build flags]

> >>

> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> >> ---

> >>  tests/tcg/mips/Makefile.target       |  15 ++-

> >>  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

> >>  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

> >>  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

> >>  4 files changed, 75 insertions(+), 229 deletions(-)

> >>

> >

> > Alex,

> >

> > How about reorganizing directories in tests/tcg/mips altogether, and make

> > it less confusing, and easier for future developers to approach an work

> on?

> >

> > Let's say like this:

> >

> > tests/tcg/mips

> >     user

> >         isa

> >             r5900

> >         ase

> >             dsp

> >             dsp_r2

> >     system

> >         isa   《for now empty》

> >         ase

> >             dsp

> >             dsp_r2

>

> Yeah sounds like a plan. I'm going to do the same with cris (bare and

> libc).

>

> >

> > Thanks,

> > Aleksandar

>

>

> --

> Alex Bennée

>
Alex Bennée Dec. 28, 2018, 10:28 a.m. UTC | #8
Aleksandar Markovic <aleksandar.m.mail@gmail.com> writes:

> HI, Alex, just a heads up that I plan to submit directory and file

> reorganization of tests/tcg/mips mini patch series today or tomorrow.

> Aleksandar


My current tree state is:

  https://github.com/stsquad/qemu/tree/testing/enable-system-tcg-tests-v2

But I'm still having trouble generating nicely linked no-pic code. But
I'll happily re-base after you've re-organised the tree. Will you be
testing the build as is with the current Makefiles?

>

> On Wednesday, December 19, 2018, Alex Bennée <alex.bennee@linaro.org> wrote:

>

>>

>> Aleksandar Markovic <aleksandar.m.mail@gmail.com> writes:

>>

>> > On Dec 10, 2018 4:29 PM, "Alex Bennée" <alex.bennee@linaro.org> wrote:

>> >>

>> >> Convert the existing tests to use our common cross build

>> >> infrastructure.

>> >>

>> >> [WIP: mips32r2 disabled to avoid name clash]

>> >> [WIP: mipsr5900 disabled due to clashing build flags]

>> >>

>> >> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> >> ---

>> >>  tests/tcg/mips/Makefile.target       |  15 ++-

>> >>  tests/tcg/mips/mips32-dsp/Makefile   | 166 +++++----------------------

>> >>  tests/tcg/mips/mips32-dspr2/Makefile |  83 +++-----------

>> >>  tests/tcg/mips/mipsr5900/Makefile    |  40 +++----

>> >>  4 files changed, 75 insertions(+), 229 deletions(-)

>> >>

>> >

>> > Alex,

>> >

>> > How about reorganizing directories in tests/tcg/mips altogether, and make

>> > it less confusing, and easier for future developers to approach an work

>> on?

>> >

>> > Let's say like this:

>> >

>> > tests/tcg/mips

>> >     user

>> >         isa

>> >             r5900

>> >         ase

>> >             dsp

>> >             dsp_r2

>> >     system

>> >         isa   《for now empty》

>> >         ase

>> >             dsp

>> >             dsp_r2

>>

>> Yeah sounds like a plan. I'm going to do the same with cris (bare and

>> libc).

>>

>> >

>> > Thanks,

>> > Aleksandar

>>

>>

>> --

>> Alex Bennée

>>



--
Alex Bennée
Aleksandar Markovic Dec. 28, 2018, 5:32 p.m. UTC | #9
> Will you be testing the build as is with the current Makefiles?


I will, but they should be replaced with your versions - in new directories.

v1 of my reorganization series seems to be broken on the list for some reason, but I will send v2 (hopefully more complete and improved) after New Year.

Thanks!!
Happy holidays!

Aleksandar
diff mbox series

Patch

diff --git a/tests/tcg/mips/Makefile.target b/tests/tcg/mips/Makefile.target
index 086625f533..33bb25bf8d 100644
--- a/tests/tcg/mips/Makefile.target
+++ b/tests/tcg/mips/Makefile.target
@@ -15,8 +15,17 @@  TESTS += $(MIPS_TESTS)
 hello-mips: CFLAGS+=-ffreestanding
 hello-mips: LDFLAGS+=-nostdlib
 
-# For MIPS32 and 64 we have a bunch of extra tests in sub-directories
-# however they are intended for system tests.
-
 run-hello-mips: hello-mips
 	$(call skip-test, $<, "BROKEN")
+
+# For MIPS32 and mipsr5900 we have a bunch of extra tests in sub-directories
+
+ifeq ($(TARGET_NAME),mipsel)
+-include $(MIPS_SRC)/mips32-dsp/Makefile
+
+# FIXME: doesn't build - names clash with mips32-dsp
+#-include $(MIPS_SRC)/mips32-dspr2/Makefile
+
+# FIXME: the docker compiler can't build the binaries
+#-include $(MIPS_SRC)/mipsr5900/Makefile
+endif
diff --git a/tests/tcg/mips/mips32-dsp/Makefile b/tests/tcg/mips/mips32-dsp/Makefile
index c3a0a00944..df2dddceaa 100644
--- a/tests/tcg/mips/mips32-dsp/Makefile
+++ b/tests/tcg/mips/mips32-dsp/Makefile
@@ -1,136 +1,30 @@ 
--include ../../config-host.mak
-
-CROSS=mips64el-unknown-linux-gnu-
-
-SIM=qemu-mipsel
-SIM_FLAGS=-cpu 74Kf
-
-CC      = $(CROSS)gcc
-CFLAGS  = -mabi=32 -march=mips32r2 -mgp32 -mdsp -static
-
-TESTCASES = absq_s_ph.tst
-TESTCASES += absq_s_w.tst
-TESTCASES += addq_ph.tst
-TESTCASES += addq_s_ph.tst
-TESTCASES += addq_s_w.tst
-TESTCASES += addsc.tst
-TESTCASES += addu_qb.tst
-TESTCASES += addu_s_qb.tst
-TESTCASES += addwc.tst
-TESTCASES += bitrev.tst
-TESTCASES += bposge32.tst
-TESTCASES += cmp_eq_ph.tst
-TESTCASES += cmpgu_eq_qb.tst
-TESTCASES += cmpgu_le_qb.tst
-TESTCASES += cmpgu_lt_qb.tst
-TESTCASES += cmp_le_ph.tst
-TESTCASES += cmp_lt_ph.tst
-TESTCASES += cmpu_eq_qb.tst
-TESTCASES += cmpu_le_qb.tst
-TESTCASES += cmpu_lt_qb.tst
-TESTCASES += dpaq_sa_l_w.tst
-TESTCASES += dpaq_s_w_ph.tst
-TESTCASES += dpau_h_qbl.tst
-TESTCASES += dpau_h_qbr.tst
-TESTCASES += dpsq_sa_l_w.tst
-TESTCASES += dpsq_s_w_ph.tst
-TESTCASES += dpsu_h_qbl.tst
-TESTCASES += dpsu_h_qbr.tst
-TESTCASES += extp.tst
-TESTCASES += extpdp.tst
-TESTCASES += extpdpv.tst
-TESTCASES += extpv.tst
-TESTCASES += extr_rs_w.tst
-TESTCASES += extr_r_w.tst
-TESTCASES += extr_s_h.tst
-TESTCASES += extrv_rs_w.tst
-TESTCASES += extrv_r_w.tst
-TESTCASES += extrv_s_h.tst
-TESTCASES += extrv_w.tst
-TESTCASES += extr_w.tst
-TESTCASES += insv.tst
-TESTCASES += lbux.tst
-TESTCASES += lhx.tst
-TESTCASES += lwx.tst
-TESTCASES += madd.tst
-TESTCASES += maddu.tst
-TESTCASES += maq_sa_w_phl.tst
-TESTCASES += maq_sa_w_phr.tst
-TESTCASES += maq_s_w_phl.tst
-TESTCASES += maq_s_w_phr.tst
-TESTCASES += mfhi.tst
-TESTCASES += mflo.tst
-TESTCASES += modsub.tst
-TESTCASES += msub.tst
-TESTCASES += msubu.tst
-TESTCASES += mthi.tst
-TESTCASES += mthlip.tst
-TESTCASES += mtlo.tst
-TESTCASES += muleq_s_w_phl.tst
-TESTCASES += muleq_s_w_phr.tst
-TESTCASES += muleu_s_ph_qbl.tst
-TESTCASES += muleu_s_ph_qbr.tst
-TESTCASES += mulq_rs_ph.tst
-TESTCASES += mult.tst
-TESTCASES += multu.tst
-TESTCASES += packrl_ph.tst
-TESTCASES += pick_ph.tst
-TESTCASES += pick_qb.tst
-TESTCASES += precequ_ph_qbla.tst
-TESTCASES += precequ_ph_qbl.tst
-TESTCASES += precequ_ph_qbra.tst
-TESTCASES += precequ_ph_qbr.tst
-TESTCASES += preceq_w_phl.tst
-TESTCASES += preceq_w_phr.tst
-TESTCASES += preceu_ph_qbla.tst
-TESTCASES += preceu_ph_qbl.tst
-TESTCASES += preceu_ph_qbra.tst
-TESTCASES += preceu_ph_qbr.tst
-TESTCASES += precrq_ph_w.tst
-TESTCASES += precrq_qb_ph.tst
-TESTCASES += precrq_rs_ph_w.tst
-TESTCASES += precrqu_s_qb_ph.tst
-TESTCASES += raddu_w_qb.tst
-TESTCASES += rddsp.tst
-TESTCASES += repl_ph.tst
-TESTCASES += repl_qb.tst
-TESTCASES += replv_ph.tst
-TESTCASES += replv_qb.tst
-TESTCASES += shilo.tst
-TESTCASES += shilov.tst
-TESTCASES += shll_ph.tst
-TESTCASES += shll_qb.tst
-TESTCASES += shll_s_ph.tst
-TESTCASES += shll_s_w.tst
-TESTCASES += shllv_ph.tst
-TESTCASES += shllv_qb.tst
-TESTCASES += shllv_s_ph.tst
-TESTCASES += shllv_s_w.tst
-TESTCASES += shra_ph.tst
-TESTCASES += shra_r_ph.tst
-TESTCASES += shra_r_w.tst
-TESTCASES += shrav_ph.tst
-TESTCASES += shrav_r_ph.tst
-TESTCASES += shrav_r_w.tst
-TESTCASES += shrl_qb.tst
-TESTCASES += shrlv_qb.tst
-TESTCASES += subq_ph.tst
-TESTCASES += subq_s_ph.tst
-TESTCASES += subq_s_w.tst
-TESTCASES += subu_qb.tst
-TESTCASES += subu_s_qb.tst
-TESTCASES += wrdsp.tst
-
-all: $(TESTCASES)
-
-%.tst: %.c
-	$(CC) $(CFLAGS) $< -o $@
-
-check: $(TESTCASES)
-	@for case in $(TESTCASES); do \
-        echo $(SIM) $(SIM_FLAGS) ./$$case;\
-        $(SIM) $(SIM_FLAGS) ./$$case; \
-	done
-
-clean:
-	$(RM) -rf $(TESTCASES)
+#
+# MIPS32-DSP linux-user tests
+#
+# We don't set the VPATH for these tests as we re-use the VPATH from
+# ../Makefile and add explicit paths for the source to avoid name clashes
+# between the various sub-dirs.
+#
+
+MIPS32DSP_SRC = $(SRC_PATH)/tests/tcg/mips/mips32-dsp
+MIPS32DSP_ALL = $(wildcard $(MIPS32DSP_SRC)/*.c)
+MIPS32DSP_TESTS = $(patsubst $(MIPS32DSP_SRC)/%.c, mips32-dsp/%, $(MIPS32DSP_ALL))
+MIPS32DSP_RUNS = $(patsubst %, run-%, $(MIPS32DSP_TESTS))
+
+# add to the list of tests
+TESTS += $(MIPS32DSP_TESTS)
+
+# We need a rule to ensure we create a sub-directory to build in
+# It is a PHONY target to prevent confusion with MIPS32DSP_SRC
+.PHONY: mips32-dsp.build
+mips32-dsp.build:
+	mkdir -p mips32-dsp
+
+$(MIPS32DSP_TESTS): | mips32-dsp.build
+$(MIPS32DSP_TESTS): CFLAGS+=-mabi=32 -march=mips32r2 -mgp32 -mdsp
+
+$(MIPS32DSP_RUNS): QEMU_OPTS=-cpu 74Kf
+
+# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't enough
+run-mips32-dsp/%: mips32-dsp/%
+	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME) $(QEMU_OPTS)")
diff --git a/tests/tcg/mips/mips32-dspr2/Makefile b/tests/tcg/mips/mips32-dspr2/Makefile
index ed19581c7e..6da966abb6 100644
--- a/tests/tcg/mips/mips32-dspr2/Makefile
+++ b/tests/tcg/mips/mips32-dspr2/Makefile
@@ -1,71 +1,24 @@ 
--include ../../config-host.mak
+#
+# MIPS32-DSPR2 linux-user tests
+#
 
-CROSS=mips64el-unknown-linux-gnu-
+MIPS32_DSPR2_SRC = $(SRC_PATH)/tests/tcg/mips/mips32-dsp
+MIPS32_DSPR2_ALL = $(wildcard $(MIPS32_DSPR2_SRC)/*.c)
+MIPS32_DSPR2_TESTS = $(patsubst $(MIPS32_DSPR2_SRC)/%.c, mips32-dspr2/%, $(MIPS32_DSPR2_ALL))
+MIPS32_DSPR2_RUNS = $(patsubst %, run-%, $(MIPS32_DSPR2_TESTS))
 
-SIM=qemu-mipsel
-SIM_FLAGS=-cpu 74Kf
+# add to the list of tests
+TESTS += $(MIPS32_DSPR2_TESTS)
 
-CC      = $(CROSS)gcc
-CFLAGS  = -mabi=32 -march=mips32r2 -mgp32 -mdspr2 -static
+.PHONY: mips32-dspr2.build
+mips32-dspr2.build:
+	mkdir -p mips32-dspr2
 
-TESTCASES = absq_s_qb.tst
-TESTCASES += addqh_ph.tst
-TESTCASES += addqh_r_ph.tst
-TESTCASES += addqh_r_w.tst
-TESTCASES += addqh_w.tst
-TESTCASES += adduh_qb.tst
-TESTCASES += adduh_r_qb.tst
-TESTCASES += addu_ph.tst
-TESTCASES += addu_s_ph.tst
-TESTCASES += append.tst
-TESTCASES += balign.tst
-TESTCASES += cmpgdu_eq_qb.tst
-TESTCASES += cmpgdu_le_qb.tst
-TESTCASES += cmpgdu_lt_qb.tst
-TESTCASES += dpaqx_sa_w_ph.tst
-TESTCASES += dpa_w_ph.tst
-TESTCASES += dpax_w_ph.tst
-TESTCASES += dpaqx_s_w_ph.tst
-TESTCASES += dpsqx_sa_w_ph.tst
-TESTCASES += dpsqx_s_w_ph.tst
-TESTCASES += dps_w_ph.tst
-TESTCASES += dpsx_w_ph.tst
-TESTCASES += mul_ph.tst
-TESTCASES += mulq_rs_w.tst
-TESTCASES += mulq_s_ph.tst
-TESTCASES += mulq_s_w.tst
-TESTCASES += mulsaq_s_w_ph.tst
-TESTCASES += mulsa_w_ph.tst
-TESTCASES += mul_s_ph.tst
-TESTCASES += precr_qb_ph.tst
-TESTCASES += precr_sra_ph_w.tst
-TESTCASES += precr_sra_r_ph_w.tst
-TESTCASES += prepend.tst
-TESTCASES += shra_qb.tst
-TESTCASES += shra_r_qb.tst
-TESTCASES += shrav_qb.tst
-TESTCASES += shrav_r_qb.tst
-TESTCASES += shrl_ph.tst
-TESTCASES += shrlv_ph.tst
-TESTCASES += subqh_ph.tst
-TESTCASES += subqh_r_ph.tst
-TESTCASES += subqh_r_w.tst
-TESTCASES += subqh_w.tst
-TESTCASES += subuh_qb.tst
-TESTCASES += subuh_r_qb.tst
-TESTCASES += subu_ph.tst
-TESTCASES += subu_s_ph.tst
+$(MIPS32_DSPR2_TESTS): | mips32-dspr2.build
+$(MIPS32_DSPR2_TESTS): CFLAGS+=-mabi=32 -march=mips32r2 -mgp32 -mdspr2
 
-all: $(TESTCASES)
+$(MIPS32_DSPR2_RUNS): QEMU_OPTS=-cpu 74Kf
 
-%.tst: %.c
-	$(CC) $(CFLAGS) $< -o $@
-
-check: $(TESTCASES)
-	@for case in $(TESTCASES); do \
-        echo $(SIM) $(SIM_FLAGS) ./$$case;\
-		$(SIM) $(SIM_FLAGS) ./$$case; \
-	done
-
-clean:
-	$(RM) -rf $(TESTCASES)
+# FIXME: I don't know why the general rule in tests/tcg/Makefile isn't enough
+run-mips32-dspr2/%: mips32-dspr2/%
+	$(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME) $(QEMU_OPTS)")
diff --git a/tests/tcg/mips/mipsr5900/Makefile b/tests/tcg/mips/mipsr5900/Makefile
index a1c388bc3c..7880e76986 100644
--- a/tests/tcg/mips/mipsr5900/Makefile
+++ b/tests/tcg/mips/mipsr5900/Makefile
@@ -1,30 +1,20 @@ 
--include ../../config-host.mak
+#
+# MIPSR5900 linux-user tests
+#
 
-CROSS=mipsr5900el-unknown-linux-gnu-
+MIPSR5900_SRC = $(SRC_PATH)/tests/tcg/mips/mipsr5900
+MIPSR5900_ALL = $(wildcard $(MIPSR5900_SRC)/*.c)
+MIPSR5900_TESTS = $(patsubst $(MIPSR5900_SRC)/%.c, %, $(MIPSR5900_ALL))
+MIPSR5900_RUNS = $(patsubst %, run-%, $(MIPSR5900_TESTS))
 
-SIM=qemu-mipsel
-SIM_FLAGS=-cpu R5900
+# add to the list of tests
+TESTS += $(MIPSR5900_TESTS)
 
-CC      = $(CROSS)gcc
-CFLAGS  = -Wall -mabi=32 -march=r5900 -static
+.PHONY: mipsr5900.build
+mipsr5900.build:
+	mkdir -p mipsr5900
 
-TESTCASES = div1.tst
-TESTCASES += divu1.tst
-TESTCASES += mflohi1.tst
-TESTCASES += mtlohi1.tst
-TESTCASES += mult.tst
-TESTCASES += multu.tst
+$(MIPS32DSP_TESTS): | mipsr5900.build
+$(MIPSR5900_TESTS): CFLAGS+=-mabi=32 -march=r5900 -msingle-float
 
-all: $(TESTCASES)
-
-%.tst: %.c
-	$(CC) $(CFLAGS) $< -o $@
-
-check: $(TESTCASES)
-	@for case in $(TESTCASES); do \
-        echo $(SIM) $(SIM_FLAGS) ./$$case;\
-        $(SIM) $(SIM_FLAGS) ./$$case; \
-	done
-
-clean:
-	$(RM) -rf $(TESTCASES)
+$(MIPSR5900_RUNS): QEMU_OPTS=-cpu R5900