[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instructi
From: |
Fredrik Noring |
Subject: |
[Qemu-devel] [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instructions PCPYUD and PCPYLD |
Date: |
Sun, 13 Jan 2019 20:07:29 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Signed-off-by: Fredrik Noring <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
- [Qemu-devel] [PATCH 2/9] target/mips: Introduce 32 R5900 128-bit multimedia registers, (continued)
- [Qemu-devel] [PATCH 2/9] target/mips: Introduce 32 R5900 128-bit multimedia registers, Fredrik Noring, 2019/01/13
- [Qemu-devel] [PATCH 3/9] target/mips: Support the R5900 PCPYLD multimedia instruction, Fredrik Noring, 2019/01/13
- [Qemu-devel] [PATCH 4/9] target/mips: Support the R5900 PCPYUD multimedia instruction, Fredrik Noring, 2019/01/13
- [Qemu-devel] [PATCH 5/9] target/mips: Support the R5900 LQ multimedia instruction, Fredrik Noring, 2019/01/13
- [Qemu-devel] [PATCH 6/9] target/mips: Support the R5900 SQ multimedia instruction, Fredrik Noring, 2019/01/13
- [Qemu-devel] [PATCH 7/9] tests/tcg/mips: Test R5900 multimedia instructions PCPYUD and PCPYLD,
Fredrik Noring <=
- [Qemu-devel] [PATCH 8/9] tests/tcg/mips: Test R5900 multimedia instruction LQ, Fredrik Noring, 2019/01/13
- [Qemu-devel] [PATCH 9/9] tests/tcg/mips: Test R5900 multimedia instruction SQ, Fredrik Noring, 2019/01/13
- Re: [Qemu-devel] [PATCH 0/9] target/mips: Limited support for R5900 multimedia instructions, no-reply, 2019/01/13