qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Simpson <tsimpson@quicinc.com>
To: qemu-devel@nongnu.org
Cc: tsimpson@quicinc.com, richard.henderson@linaro.org,
	philmd@linaro.org, peter.maydell@linaro.org, bcain@quicinc.com,
	quic_mathbern@quicinc.com, stefanha@redhat.com, ale@rev.ng,
	anjo@rev.ng, quic_mliebel@quicinc.com
Subject: [PULL v2 09/44] Hexagon (tests/tcg/hexagon) Add v73 scalar tests
Date: Thu, 18 May 2023 13:03:36 -0700	[thread overview]
Message-ID: <20230518200411.271148-10-tsimpson@quicinc.com> (raw)
In-Reply-To: <20230518200411.271148-1-tsimpson@quicinc.com>

Tests added for the following instructions
    J2_callrh
    J2_jumprh

Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
Reviewed-by: Anton Johansson <anjo@rev.ng>
Message-Id: <20230427224057.3766963-10-tsimpson@quicinc.com>
---
 tests/tcg/hexagon/v73_scalar.c    | 96 +++++++++++++++++++++++++++++++
 tests/tcg/hexagon/Makefile.target |  2 +
 2 files changed, 98 insertions(+)
 create mode 100644 tests/tcg/hexagon/v73_scalar.c

diff --git a/tests/tcg/hexagon/v73_scalar.c b/tests/tcg/hexagon/v73_scalar.c
new file mode 100644
index 0000000000..fee67fc531
--- /dev/null
+++ b/tests/tcg/hexagon/v73_scalar.c
@@ -0,0 +1,96 @@
+/*
+ *  Copyright(c) 2023 Qualcomm Innovation Center, Inc. All Rights Reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <stdbool.h>
+#include <stdint.h>
+
+/*
+ *  Test the scalar core instructions that are new in v73
+ */
+
+int err;
+
+static void __check32(int line, uint32_t result, uint32_t expect)
+{
+    if (result != expect) {
+        printf("ERROR at line %d: 0x%08x != 0x%08x\n",
+               line, result, expect);
+        err++;
+    }
+}
+
+#define check32(RES, EXP) __check32(__LINE__, RES, EXP)
+
+static void __check64(int line, uint64_t result, uint64_t expect)
+{
+    if (result != expect) {
+        printf("ERROR at line %d: 0x%016llx != 0x%016llx\n",
+               line, result, expect);
+        err++;
+    }
+}
+
+#define check64(RES, EXP) __check64(__LINE__, RES, EXP)
+
+static bool my_func_called;
+
+static void my_func(void)
+{
+    my_func_called = true;
+}
+
+static inline void callrh(void *func)
+{
+    asm volatile("callrh %0\n\t"
+                 : : "r"(func)
+                 /* Mark the caller-save registers as clobbered */
+                 : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
+                   "r10", "r11", "r12", "r13", "r14", "r15", "r28",
+                   "p0", "p1", "p2", "p3");
+}
+
+static void test_callrh(void)
+{
+    my_func_called = false;
+    callrh(&my_func);
+    check32(my_func_called, true);
+}
+
+static void test_jumprh(void)
+{
+    uint32_t res;
+    asm ("%0 = #5\n\t"
+         "r0 = ##1f\n\t"
+         "jumprh r0\n\t"
+         "%0 = #3\n\t"
+         "jump 2f\n\t"
+         "1:\n\t"
+         "%0 = #1\n\t"
+         "2:\n\t"
+         : "=r"(res) : : "r0");
+    check32(res, 1);
+}
+
+int main()
+{
+    test_callrh();
+    test_jumprh();
+
+    puts(err ? "FAIL" : "PASS");
+    return err ? 1 : 0;
+}
diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile.target
index 558c056148..3172f2e4db 100644
--- a/tests/tcg/hexagon/Makefile.target
+++ b/tests/tcg/hexagon/Makefile.target
@@ -79,6 +79,7 @@ HEX_TESTS += test_vspliceb
 HEX_TESTS += v68_scalar
 HEX_TESTS += v68_hvx
 HEX_TESTS += v69_hvx
+HEX_TESTS += v73_scalar
 
 TESTS += $(HEX_TESTS)
 
@@ -98,6 +99,7 @@ v68_hvx: v68_hvx.c hvx_misc.h v6mpy_ref.c.inc
 v68_hvx: CFLAGS += -mhvx -Wno-unused-function
 v69_hvx: v69_hvx.c hvx_misc.h
 v69_hvx: CFLAGS += -mhvx -Wno-unused-function
+v73_scalar: CFLAGS += -Wno-unused-function
 
 hvx_histogram: hvx_histogram.c hvx_histogram_row.S
 	$(CC) $(CFLAGS) $(CROSS_CC_GUEST_CFLAGS) $^ -o $@ $(LDFLAGS)
-- 
2.25.1


  parent reply	other threads:[~2023-05-18 20:09 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 20:03 [PULL v2 00/44] Hexagon update Taylor Simpson
2023-05-18 20:03 ` [PULL v2 01/44] Hexagon (target/hexagon) Add support for v68/v69/v71/v73 Taylor Simpson
2023-05-18 20:03 ` [PULL v2 02/44] Hexagon (target/hexagon) Add v68 scalar instructions Taylor Simpson
2023-05-18 20:03 ` [PULL v2 03/44] Hexagon (tests/tcg/hexagon) Add v68 scalar tests Taylor Simpson
2023-05-18 20:03 ` [PULL v2 04/44] Hexagon (target/hexagon) Add v68 HVX instructions Taylor Simpson
2023-05-18 20:03 ` [PULL v2 05/44] Hexagon (tests/tcg/hexagon) Add v68 HVX tests Taylor Simpson
2023-05-18 20:03 ` [PULL v2 06/44] Hexagon (target/hexagon) Add v69 HVX instructions Taylor Simpson
2023-05-18 20:03 ` [PULL v2 07/44] Hexagon (tests/tcg/hexagon) Add v69 HVX tests Taylor Simpson
2023-05-18 20:03 ` [PULL v2 08/44] Hexagon (target/hexagon) Add v73 scalar instructions Taylor Simpson
2023-05-18 20:03 ` Taylor Simpson [this message]
2023-05-18 20:03 ` [PULL v2 10/44] meson.build Add CONFIG_HEXAGON_IDEF_PARSER Taylor Simpson
2023-05-18 20:03 ` [PULL v2 11/44] Hexagon (target/hexagon) Add DisasContext arg to gen_log_reg_write Taylor Simpson
2023-05-18 20:03 ` [PULL v2 12/44] Hexagon (target/hexagon) Add overrides for loop setup instructions Taylor Simpson
2023-05-18 20:03 ` [PULL v2 13/44] Hexagon (target/hexagon) Add overrides for allocframe/deallocframe Taylor Simpson
2023-05-18 20:03 ` [PULL v2 14/44] Hexagon (target/hexagon) Add overrides for clr[tf]new Taylor Simpson
2023-05-18 20:03 ` [PULL v2 15/44] Hexagon (target/hexagon) Remove log_reg_write from op_helper.[ch] Taylor Simpson
2023-05-18 20:03 ` [PULL v2 16/44] Hexagon (target/hexagon) Eliminate uses of log_pred_write function Taylor Simpson
2023-05-18 20:03 ` [PULL v2 17/44] Hexagon (target/hexagon) Clean up pred_written usage Taylor Simpson
2023-05-18 20:03 ` [PULL v2 18/44] Hexagon (target/hexagon) Don't overlap dest writes with source reads Taylor Simpson
2023-05-18 20:03 ` [PULL v2 19/44] Hexagon (target/hexagon) Mark registers as read during packet analysis Taylor Simpson
2023-05-18 20:03 ` [PULL v2 20/44] Hexagon (target/hexagon) Short-circuit packet register writes Taylor Simpson
2023-05-18 20:03 ` [PULL v2 21/44] Hexagon (target/hexagon) Short-circuit packet predicate writes Taylor Simpson
2023-05-18 20:03 ` [PULL v2 22/44] Hexagon (target/hexagon) Short-circuit packet HVX writes Taylor Simpson
2023-05-18 20:03 ` [PULL v2 23/44] Hexagon (target/hexagon) Short-circuit more HVX single instruction packets Taylor Simpson
2023-05-18 20:03 ` [PULL v2 24/44] Hexagon (target/hexagon) Add overrides for disabled idef-parser insns Taylor Simpson
2023-05-18 20:03 ` [PULL v2 25/44] Hexagon (target/hexagon) Make special new_value for USR Taylor Simpson
2023-05-18 20:03 ` [PULL v2 26/44] Hexagon (target/hexagon) Move new_value to DisasContext Taylor Simpson
2023-05-18 20:03 ` [PULL v2 27/44] Hexagon (target/hexagon) Move new_pred_value " Taylor Simpson
2023-05-18 20:03 ` [PULL v2 28/44] Hexagon (target/hexagon) Move pred_written " Taylor Simpson
2023-05-18 20:03 ` [PULL v2 29/44] Hexagon (target/hexagon) Move pkt_has_store_s1 " Taylor Simpson
2023-05-18 20:03 ` [PULL v2 30/44] Hexagon (target/hexagon) Move items " Taylor Simpson
2023-05-18 20:03 ` [PULL v2 31/44] Hexagon (target/hexagon) Additional instructions handled by idef-parser Taylor Simpson
2023-05-18 20:03 ` [PULL v2 32/44] target/hexagon: fix = vs. == mishap Taylor Simpson
2023-05-18 20:04 ` [PULL v2 33/44] Hexagon (target/hexagon/*.py): raise exception on reg parsing error Taylor Simpson
2023-05-18 20:04 ` [PULL v2 34/44] Hexagon: list available CPUs with `-cpu help` Taylor Simpson
2023-05-18 20:04 ` [PULL v2 35/44] Hexagon: append eflags to unknown cpu model string Taylor Simpson
2023-05-18 20:04 ` [PULL v2 36/44] Hexagon (iclass): update J4_hintjumpr slot constraints Taylor Simpson
2023-05-18 20:04 ` [PULL v2 37/44] Hexagon (decode): look for pkts with multiple insns at the same slot Taylor Simpson
2023-05-18 20:04 ` [PULL v2 38/44] Remove test_vshuff from hvx_misc tests Taylor Simpson
2023-05-18 20:04 ` [PULL v2 39/44] gdbstub: only send stop-reply packets when allowed to Taylor Simpson
2023-05-18 20:04 ` [PULL v2 40/44] gdbstub: add test for untimely stop-reply packets Taylor Simpson
2023-08-04 14:57   ` Richard Henderson
2023-08-07 13:01     ` Matheus Tavares Bernardino
2023-05-18 20:04 ` [PULL v2 41/44] Hexagon: add core gdbstub xml data for LLDB Taylor Simpson
2023-05-18 20:04 ` [PULL v2 42/44] Hexagon (gdbstub): fix p3:0 read and write via stub Taylor Simpson
2023-05-18 20:04 ` [PULL v2 43/44] Hexagon (gdbstub): add HVX support Taylor Simpson
2023-05-18 20:04 ` [PULL v2 44/44] Hexagon (linux-user/hexagon): handle breakpoints Taylor Simpson
2023-05-19 14:55 ` [PULL v2 00/44] Hexagon update Richard Henderson

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=20230518200411.271148-10-tsimpson@quicinc.com \
    --to=tsimpson@quicinc.com \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=bcain@quicinc.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quic_mathbern@quicinc.com \
    --cc=quic_mliebel@quicinc.com \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    /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).