qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instr


From: Aleksandar Markovic
Subject: Re: [Qemu-devel] [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instructions PCPYUD and PCPYLD
Date: Tue, 15 Jan 2019 21:45:52 +0000

> From: Fredrik Noring <address@hidden>
> Sent: Sunday, January 13, 2019 8:07 PM
> To: Aleksandar Markovic; Aurelien Jarno; Philippe Mathieu-Daudé
> Cc: Jürgen Urban; Maciej W. Rozycki; address@hidden
> Subject: [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instructions 
> PCPYUD and PCPYLD
> 
> Signed-off-by: Fredrik Noring <address@hidden>
> ---

Please just add a commit message. Otherwise:

Reviewed-by: Aleksandar Markovic <address@hidden>

>  tests/tcg/mips/mipsn32r5900/Makefile  | 25 +++++++++++++++
>  tests/tcg/mips/mipsn32r5900/pcpyuld.c | 46 +++++++++++++++++++++++++++
>  2 files changed, 71 insertions(+)
>  create mode 100644 tests/tcg/mips/mipsn32r5900/Makefile
>  create mode 100644 tests/tcg/mips/mipsn32r5900/pcpyuld.c
> 
> diff --git a/tests/tcg/mips/mipsn32r5900/Makefile 
> b/tests/tcg/mips/mipsn32r5900/Makefile
> new file mode 100644
> index 0000000000..f4887678ae
> --- /dev/null
> +++ b/tests/tcg/mips/mipsn32r5900/Makefile
> @@ -0,0 +1,25 @@
> +-include ../../config-host.mak
> +
> +CROSS=mips64r5900el-unknown-linux-gnu-
> +
> +SIM=qemu-mipsn32el
> +SIM_FLAGS=-cpu R5900
> +
> +CC      = $(CROSS)gcc
> +CFLAGS  = -Wall -mabi=n32 -march=r5900 -static
> +
> +TESTCASES = pcpyuld.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)
> diff --git a/tests/tcg/mips/mipsn32r5900/pcpyuld.c 
> b/tests/tcg/mips/mipsn32r5900/pcpyuld.c
> new file mode 100644
> index 0000000000..c92af6330b
> --- /dev/null
> +++ b/tests/tcg/mips/mipsn32r5900/pcpyuld.c
> @@ -0,0 +1,46 @@
> +/*
> + * Test PCPYUD and PCPYLD.
> + */
> +
> +#include <stdio.h>
> +#include <string.h>
> +#include <inttypes.h>
> +#include <assert.h>
> +
> +/* 128-bit multimedia register */
> +struct mmr { uint64_t hi, lo; } __attribute__((aligned(16)));
> +
> +static void verify_zero(void)
> +{
> +    __asm__ __volatile__ (
> +        "    pcpyud  $0, $0, $0\n"
> +        "    pcpyld  $0, $0, $0\n"
> +    );
> +}
> +
> +static void verify_copy(void)
> +{
> +    const struct mmr value = {
> +        .hi = 0x6665646362613938,
> +        .lo = 0x3736353433323130
> +    };
> +    struct mmr result = { };
> +
> +    __asm__ __volatile__ (
> +        "    pcpyld  %0, %2, %3\n"
> +        "    move    %1, %0\n"
> +        "    pcpyud  %0, %0, %0\n"
> +        : "=r" (result.hi), "=r" (result.lo)
> +        : "r" (value.hi), "r" (value.lo));
> +
> +    assert(value.hi == result.hi);
> +    assert(value.lo == result.lo);
> +}
> +
> +int main()
> +{
> +    verify_zero();
> +    verify_copy();
> +
> +    return 0;
> +}
> --
> 2.19.2
> 
> 


reply via email to

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