From: Yongbok Kim <yongbok.kim@imgtec.com>
To: qemu-devel@nongnu.org
Cc: leon.alrae@imgtec.com, aurelien@aurel32.net
Subject: [Qemu-devel] [PATCH v2 08/20] target-mips: add msa_helper.c
Date: Wed, 29 Oct 2014 01:41:56 +0000 [thread overview]
Message-ID: <1414546928-54642-9-git-send-email-yongbok.kim@imgtec.com> (raw)
In-Reply-To: <1414546928-54642-1-git-send-email-yongbok.kim@imgtec.com>
add msa_helper.c
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
---
target-mips/Makefile.objs | 2 +-
target-mips/msa_helper.c | 49 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletions(-)
create mode 100644 target-mips/msa_helper.c
diff --git a/target-mips/Makefile.objs b/target-mips/Makefile.objs
index 716244f..108fd9b 100644
--- a/target-mips/Makefile.objs
+++ b/target-mips/Makefile.objs
@@ -1,4 +1,4 @@
obj-y += translate.o dsp_helper.o op_helper.o lmi_helper.o helper.o cpu.o
-obj-y += gdbstub.o
+obj-y += gdbstub.o msa_helper.o
obj-$(CONFIG_SOFTMMU) += machine.o
obj-$(CONFIG_KVM) += kvm.o
diff --git a/target-mips/msa_helper.c b/target-mips/msa_helper.c
new file mode 100644
index 0000000..b65fb27
--- /dev/null
+++ b/target-mips/msa_helper.c
@@ -0,0 +1,49 @@
+/*
+ * MIPS SIMD Architecture Module Instruction emulation helpers for QEMU.
+ *
+ * Copyright (c) 2014 Imagination Technologies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "cpu.h"
+#include "exec/helper-proto.h"
+
+/* Data format min and max values */
+#define DF_BITS(df) (1 << ((df) + 3))
+
+#define DF_MAX_INT(df) (int64_t)((1LL << (DF_BITS(df) - 1)) - 1)
+#define M_MAX_INT(m) (int64_t)((1LL << ((m) - 1)) - 1)
+
+#define DF_MIN_INT(df) (int64_t)(-(1LL << (DF_BITS(df) - 1)))
+#define M_MIN_INT(m) (int64_t)(-(1LL << ((m) - 1)))
+
+#define DF_MAX_UINT(df) (uint64_t)(-1ULL >> (64 - DF_BITS(df)))
+#define M_MAX_UINT(m) (uint64_t)(-1ULL >> (64 - (m)))
+
+#define UNSIGNED(x, df) ((x) & DF_MAX_UINT(df))
+#define SIGNED(x, df) \
+ ((((int64_t)x) << (64 - DF_BITS(df))) >> (64 - DF_BITS(df)))
+
+/* Element-by-element access macros */
+#define DF_ELEMENTS(df) (MSA_WRLEN / DF_BITS(df))
+
+static inline void msa_move_v(wr_t *pwd, wr_t *pws)
+{
+ uint32_t i;
+
+ for (i = 0; i < DF_ELEMENTS(DF_DOUBLE); i++) {
+ pwd->d[i] = pws->d[i];
+ }
+}
--
1.7.4
next prev parent reply other threads:[~2014-10-29 1:42 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 1:41 [Qemu-devel] [PATCH v2 00/20] target-mips: add MSA module Yongbok Kim
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 01/20] target-mips: add MSA defines and data structure Yongbok Kim
2014-10-29 9:50 ` James Hogan
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 02/20] target-mips: add MSA exceptions Yongbok Kim
2014-10-29 9:56 ` James Hogan
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 03/20] target-mips: remove duplicated mips/ieee mapping function Yongbok Kim
2014-10-29 10:04 ` James Hogan
2014-10-29 22:55 ` Leon Alrae
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 04/20] target-mips: add 16, 64 bit load and store Yongbok Kim
2014-10-29 10:21 ` James Hogan
2014-10-29 22:56 ` Leon Alrae
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 05/20] target-mips: stop translation after ctc1 Yongbok Kim
2014-10-29 10:26 ` James Hogan
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 06/20] target-mips: add MSA opcode enum Yongbok Kim
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 07/20] target-mips: add msa_reset(), global msa register Yongbok Kim
2014-10-29 10:36 ` James Hogan
2014-11-05 17:36 ` Richard Henderson
2014-10-29 1:41 ` Yongbok Kim [this message]
2014-10-29 10:50 ` [Qemu-devel] [PATCH v2 08/20] target-mips: add msa_helper.c James Hogan
2014-10-29 22:57 ` Leon Alrae
2014-11-05 17:38 ` Richard Henderson
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 09/20] target-mips: add MSA branch instructions Yongbok Kim
2014-10-29 11:19 ` James Hogan
2014-11-05 17:41 ` Richard Henderson
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 10/20] target-mips: add MSA I8 format instructions Yongbok Kim
2014-10-29 11:38 ` James Hogan
2014-11-05 17:43 ` Richard Henderson
2014-11-06 11:49 ` Yongbok Kim
2014-10-29 1:41 ` [Qemu-devel] [PATCH v2 11/20] target-mips: add MSA I5 format instruction Yongbok Kim
2014-10-29 23:23 ` James Hogan
2014-10-29 23:27 ` Leon Alrae
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 12/20] target-mips: add MSA BIT format instructions Yongbok Kim
2014-10-30 8:02 ` Leon Alrae
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 13/20] target-mips: add MSA 3R " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 14/20] target-mips: add MSA ELM " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 15/20] target-mips: add MSA 3RF " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 16/20] target-mips: add MSA VEC/2R " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 17/20] target-mips: add MSA 2RF " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 18/20] target-mips: add MSA MI10 " Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 19/20] disas/mips.c: disassemble MSA instructions Yongbok Kim
2014-10-29 1:42 ` [Qemu-devel] [PATCH v2 20/20] target-mips: add MSA support to mips32r5-generic Yongbok Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414546928-54642-9-git-send-email-yongbok.kim@imgtec.com \
--to=yongbok.kim@imgtec.com \
--cc=aurelien@aurel32.net \
--cc=leon.alrae@imgtec.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).