From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15050C2B9F4 for ; Fri, 25 Jun 2021 23:58:01 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 636B56195B for ; Fri, 25 Jun 2021 23:58:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 636B56195B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:34082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwvhv-0001yN-I9 for qemu-devel@archiver.kernel.org; Fri, 25 Jun 2021 19:57:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwvhB-0001I1-7u for qemu-devel@nongnu.org; Fri, 25 Jun 2021 19:57:13 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:41961) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwvh8-0002mw-0Y for qemu-devel@nongnu.org; Fri, 25 Jun 2021 19:57:13 -0400 Received: by mail-wm1-x332.google.com with SMTP id a5-20020a7bc1c50000b02901e3bbe0939bso6885062wmj.0 for ; Fri, 25 Jun 2021 16:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=sk/3rMptBhw76K5YL1UhKtJpUS4KU7DP0GpYJKfa8hw=; b=VuZ4eENnKGYmeny2sk15HyE1eryBJxJ6PlpFXj17CcKywPwy2MU9NPo1y06reMBJhQ 7sGgRV8Tb11kfnADgVueh5kenr0CTBxha2dcvtH0hvYwjP+4bg5A9GDdm1c5QfwiTy04 J0ycLm8SXgyClC4bcw+rV980eRed1ZPKgiJ91xLf0tMih9shS32wlILQ+oadoqOKdiG5 OYUHegjhB/XH/twpP0JDiXVMUUYus3Jj40KowgDidigh9DTQmD6+p2moy+wbxLQF4GLi mLD8bNkSBKGixnpkkaOVMosZ/To9oF2YAPw0oyPpWegCXF8M2EhKiDBSC001IPFxmPu9 k6EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sk/3rMptBhw76K5YL1UhKtJpUS4KU7DP0GpYJKfa8hw=; b=ZOQJ4D0f0RRDHVyscQNTl+7nGIxF94L5vjVhyJ/MNRrcnpFSMXQAOHt2zF2N8vlUNA pkdNu3chb5qcqXJbuieSINia2hHBCQ6R2HPrVHbH8YqCDC9e4/9CuNGVfwpKMa4pRZ9N PpqEjJuLEkGIcyP8F8LkcNPqVUSl+Sag3BNoifq9ZVT4XvW2B4ZK4MEUanoPHHdcqdUB 2UFFR/s8Tb4UToB2QCFlHvKrea1hZYaPn1wpGBztd937stpJkSiTio92KrZmmJ5Ka6wV epHsHTK6n5o+o397dPqdXrycJWl5WMpeCX8a25K1Z91PDwgJsEHmcD7uSELwr9RVmiVY qHCQ== X-Gm-Message-State: AOAM530b6cyft7WObaFgcxxnk4NHjNziYD9DijcpAjb79RTK91QdCbHL d2MMRx2XF0RvNWFVASZ7wD0lmFkdvh3dVmfIuLs= X-Google-Smtp-Source: ABdhPJyx9zdOuAu9qSVeZ1sndGt+QZ6DPuixm+ijmWXFPQWra0FUdw5XjqnToBCTwuDZJLBsMLnpFtp6mNBCa0tOrMI= X-Received: by 2002:a05:600c:3794:: with SMTP id o20mr13537059wmr.106.1624665428439; Fri, 25 Jun 2021 16:57:08 -0700 (PDT) MIME-Version: 1.0 References: <20210619093713.1845446-1-ale.qemu@rev.ng> <20210619093713.1845446-14-ale.qemu@rev.ng> In-Reply-To: <20210619093713.1845446-14-ale.qemu@rev.ng> From: Taylor Simpson Date: Fri, 25 Jun 2021 18:56:57 -0500 Message-ID: Subject: Re: [PATCH v5 13/14] target/hexagon: import additional tests To: Alessandro Di Federico Content-Type: multipart/alternative; boundary="000000000000bdb6b405c59fe571" Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=taylor.qemu@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alessandro Di Federico , bcain@quicinc.com, richard.henderson@linaro.org, qemu-devel@nongnu.org, babush@rev.ng, tsimpson@quicinc.com, nizzo@rev.ng, philmd@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000bdb6b405c59fe571 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, Jun 19, 2021 at 4:49 AM Alessandro Di Federico via < qemu-devel@nongnu.org> wrote: > From: Niccol=C3=B2 Izzo > > Signed-off-by: Alessandro Di Federico > Signed-off-by: Niccol=C3=B2 Izzo > --- > > diff --git a/tests/tcg/hexagon/crt.S b/tests/tcg/hexagon/crt.S > new file mode 100644 > index 0000000000..2c10577470 > --- /dev/null > +++ b/tests/tcg/hexagon/crt.S > @@ -0,0 +1,28 @@ > +#define SYS_exit_group 94 > + > + .text > + .globl init > +init: > + { > + allocframe(r29,#0):raw > + } > + { > + r0=3D#256 > + } > + { > + dealloc_return > + } > You don't need to alloc/dealloc the frame, just a single packet { r0 =3D #256; jumpr r31 } Then again, why is this function needed at all? + > + .space 240 > Why is this space needed? diff --git a/tests/tcg/hexagon/test_andp.S b/tests/tcg/hexagon/test_andp.S > new file mode 100644 > index 0000000000..3c4aa8b2ae > --- /dev/null > +++ b/tests/tcg/hexagon/test_andp.S > @@ -0,0 +1,23 @@ > +/* Purpose: test a multiple predicate AND combination */ > This is already tested in misc.c + > + .text > + .globl _start > + > +_start: > + { > + r1+=3Dsub(r2,r3) > Remove this - r1, r2, and r3 are uninitialized. Then, you overwrite r1 in the next packet. > + call init > + } > + { > + r0=3D#0 > + r1=3D#1 > + } > + { > + p0=3Dcmp.gt(r0,r1) > + p0=3Dcmp.gt(r0,r1) > + p0=3Dcmp.gt(r1,r0) > + } > + { > + if (!p0) jump:t pass > + jump fail > + } > > diff --git a/tests/tcg/hexagon/test_call.S b/tests/tcg/hexagon/test_call.= S > new file mode 100644 > index 0000000000..53a2450522 > --- /dev/null > +++ b/tests/tcg/hexagon/test_call.S > @@ -0,0 +1,63 @@ > +/* Purpose: test function calls and duplex instructions. > + * The string "Hello there, I'm a test string!" with the first letter > replaced > + * with a capital L should be printed out. > + */ > + > + .text > + .globl test > +test: > + { > + jumpr r31 > + memb(r0+#0)=3D#76 > + } > +.Lfunc_end0: > +.Ltmp0: > + .size test, .Ltmp0-test > + > + .globl _start > +_start: > + { > + call init > + } > + { > + call test > + r0=3D##dummy_buffer > + allocframe(#0) > + } > + { > + call write > + } > + { > + jump pass > + } > + { > + r31:30=3Ddeallocframe(r30):raw > + } > +.Lfunc_end1: > +.Ltmp1: > + .size _start, .Ltmp1-_start > +write: > + { > + r2=3D##dummy_buffer > + } > + { r0=3Dr2; } > Assign to r0 directly > + { > + r2=3D#256 > + } > + { r1=3Dr2; } > Assign to r1 directly + { trap0(#7); } > This doesn't print anything - the syscall number goes in r6. Is the intent to invoke SYS_write? If so, look at first.S to see how this is done. + { > + jumpr r31 > + } > +.Lfunc_end2: > +.Ltmp2: > + .size write, .Ltmp2-write > + > + .type dummy_buffer,@object > + .data > + .globl dummy_buffer > + .p2align 3 > +dummy_buffer: > + .string "Hello there, I'm a test string!\n" > + .space 223 > + .size dummy_buffer, 256 > > diff --git a/tests/tcg/hexagon/test_djump.S > b/tests/tcg/hexagon/test_djump.S > new file mode 100644 > index 0000000000..dbad7eb0a1 > --- /dev/null > +++ b/tests/tcg/hexagon/test_djump.S > @@ -0,0 +1,24 @@ > +/* Purpose: show dual jumps actually work. This program features a packe= t > where > + * two jumps should (in theory) be performed if !P0. However, we correct= ly > + * handle the situation by performing only the first one and ignoring th= e > second > + * one. This can be verified by checking that the CPU dump contains > 0xDEADBEEF > + * in R2. > + */ > How does 0xDEADBEEF get into r2? Do we need this test given that every other test relies on this idiom to check pass/fail? + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + r1 =3D #255; > + } > + { > + p0 =3D r1; > + } > + { > + if (p0) jump:t pass > + jump fail > + } > diff --git a/tests/tcg/hexagon/test_dotnew.S > b/tests/tcg/hexagon/test_dotnew.S > new file mode 100644 > index 0000000000..3897c6bc96 > --- /dev/null > +++ b/tests/tcg/hexagon/test_dotnew.S > @@ -0,0 +1,39 @@ > +/* Purpose: test the .new operator while performing memory stores. > + * In the final CPU dump R0 should contain 3, R1 should contain 2 and R2 > should > + * contain 1. > + */ > CPU dump sounds like something you have locally. The check-tcg tests should not rely on this. + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + r0=3D#1 > + memw(sp+#0)=3Dr0.new > + } > You haven't set up the stack, so you shouldn't use sp. Even if the stack were set up, you should allocframe first. + { > + r1=3D#2 > + memw(sp+#4)=3Dr1.new > + } > + { > + r2=3D#3 > + memw(sp+#8)=3Dr2.new > + } > + { > + r0=3Dmemw(sp+#8) > + } > + { > + r1=3Dmemw(sp+#4) > + } > + { > + r2=3Dmemw(sp+#0) > + } > + { > + r3=3Dmpyi(r1,r2) > + } > + { > + p0 =3D cmp.eq(r3, #2); if (p0.new) jump:t pass > + jump fail > + } > diff --git a/tests/tcg/hexagon/test_dstore.S > b/tests/tcg/hexagon/test_dstore.S > new file mode 100644 > index 0000000000..62c4301eb1 > --- /dev/null > +++ b/tests/tcg/hexagon/test_dstore.S > @@ -0,0 +1,29 @@ > +/* Purpose: test dual stores correctness. > + * In this example the values 1 and 2 are both written on the top of the > stack > + * in a single packet. > + * The value is then read back in R3, which should contain only the > latest value > + * written (2). > + */ > This is already tested in dual_stores.c + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + r0=3D#1 > + r1=3D#2 > + } > + { > + memw(sp+#0)=3Dr0 > + memw(sp+#0)=3Dr1 > + } > Stack setup ... + { > + r3=3Dmemw(sp+#0) > + } > + { > + p0 =3D cmp.eq(r3, #2); if (p0.new) jump:t pass > + jump fail > + } > diff --git a/tests/tcg/hexagon/test_ext.S b/tests/tcg/hexagon/test_ext.S > new file mode 100644 > index 0000000000..0f6e21593a > --- /dev/null > +++ b/tests/tcg/hexagon/test_ext.S > @@ -0,0 +1,18 @@ > +/* Purpose: test immediate extender instructions. > + * In the CPU dump R0 should contain 0xDEADBEEF. > The CPU dump comment doesn't apply > + */ > + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + r2=3D##-559038737 > + } > + { > + p0 =3D cmp.eq(r2, ##-559038737); if (p0.new) jump:t pass > + jump fail > + } > > +++ b/tests/tcg/hexagon/test_hello.S > @@ -0,0 +1,21 @@ > +/* Purpose: simple hello world program. */ > This is already tested in first.S + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { r0=3D#4; } > + { > + r1=3D##.L.str > + } > + { trap0(#0); } > + { > + jump pass > + } > + > +.L.str: > + .string "Hello world!\n" > + .size .L.str, 14 > > diff --git a/tests/tcg/hexagon/test_hwloops.S > b/tests/tcg/hexagon/test_hwloops.S > new file mode 100644 > index 0000000000..8337083d8e > --- /dev/null > +++ b/tests/tcg/hexagon/test_hwloops.S > @@ -0,0 +1,25 @@ > +/* Purpose: simple C Program to test hardware loops. > + * It should print numbersfrom 0 to 9. > This doesn't actually print anything. > + */ > + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + loop0(.LBB0_1,#10) > + r2=3D#0 > + } > +.Ltmp0: > +.LBB0_1: > + { > + r2=3Dadd(r2,#1) > + nop > + }:endloop0 > + { > + p0 =3D cmp.eq(r2, #10); if (p0.new) jump:t pass > + jump fail > + } > > diff --git a/tests/tcg/hexagon/test_jmp.S b/tests/tcg/hexagon/test_jmp.S > new file mode 100644 > index 0000000000..9bf6ea34e5 > --- /dev/null > +++ b/tests/tcg/hexagon/test_jmp.S > @@ -0,0 +1,25 @@ > +/* Purpose: test example, verify the soundness of the add operation */ > What value does this test have beyond the others in this set? + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + r1=3D#0 > + r2=3D#0 > + } > + { > + r3=3Dadd(r1,r2) > + } > + { > + p0 =3D cmp.eq(r3, #0) > + } > + { > + if (p0) jump:t pass > + } > + { > + jump fail > + } > diff --git a/tests/tcg/hexagon/test_packet.S b/tests/tcg/hexagon/test_packet.S > new file mode 100644 > index 0000000000..d26e284be9 > --- /dev/null > +++ b/tests/tcg/hexagon/test_packet.S > @@ -0,0 +1,26 @@ > +/* Purpose: test that writes of a register in a packet are performed onl= y > after > + * that packet has finished its execution. > + */ > + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { > + r2=3D#4 > + r3=3D#6 > + } > + { > + memw(sp+#0)=3Dr2 > Stack problem + } > + { > + r3=3Dmemw(sp+#0) > + r0=3Dadd(r2,r3) > + } > + { > + p0 =3D cmp.eq(r0, #10); if (p0.new) jump:t pass > + jump fail > + } > diff --git a/tests/tcg/hexagon/test_reorder.S > b/tests/tcg/hexagon/test_reorder.S > new file mode 100644 > index 0000000000..508d5302f9 > --- /dev/null > +++ b/tests/tcg/hexagon/test_reorder.S > @@ -0,0 +1,31 @@ > +/* Purpose: demonstrate handling of .new uses appearing before the > associated > + * definition. > + * Here we perform a jump that skips the code resetting R2 from > 0xDEADBEEF to 0, > + * only if P0.new is true, but P0 is assigned to 1 (R4) in the next > instruction > + * in the packet. > + * A successful run of the program will show R2 retaining the 0xDEADBEEF > value > + * in the CPU dump. > CPU dump ... + */ > + > + .text > + .globl _start > + > +_start: > + { > + call init > + } > + { r2=3D#-559038737 } > + { r4=3D#1 } > + { > + if (p0.new) jump:nt skip > + p0=3Dr4; > + } > + > +fallthrough: > + { r2=3D#0 } > + > +skip: > + { > + p0 =3D cmp.eq(r2, #-559038737); if (p0.new) jump:t pass > + jump fail > + } > Each of these are very small, so I recommend putting them into misc.c or combine all the assembly into a small number of executables. --000000000000bdb6b405c59fe571 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Sat, Jun 19, 2021 at 4:49 AM Aless= andro Di Federico via <qemu-dev= el@nongnu.org> wrote:
From: Niccol=C3=B2 Izzo <nizzo@rev.ng>

Signed-off-by: Alessandro Di Federico <ale@rev.ng>
Signed-off-by: Niccol=C3=B2 Izzo <nizzo@rev.ng>
---
=C2=A0
diff --git a/tests/tcg/hexagon/crt.S b/tests/tcg/hexagon/crt.S<= br> new file mode 100644
index 0000000000..2c10577470
--- /dev/null
+++ b/tests/tcg/hexagon/crt.S
@@ -0,0 +1,28 @@
+#define SYS_exit_group=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A094
+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl init
+init:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 allocframe(r29,#0):raw
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3D#256
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 dealloc_return
+=C2=A0 =C2=A0 }

You don't need to = alloc/dealloc the frame, just a single packet { r0 =3D #256; jumpr r31 }

Then again, why is this function needed at all?


+
+=C2=A0 =C2=A0 .space 240

Why is this s= pace needed?

diff --git a/tests/tcg/hexagon/test_andp.S b/tests/tcg/hexagon/t= est_andp.S
new file mode 100644
index 0000000000..3c4aa8b2ae
--- /dev/null
+++ b/tests/tcg/hexagon/test_andp.S
@@ -0,0 +1,23 @@
+/* Purpose: test a multiple predicate AND combination */
<= div>
This is already tested in misc.c

+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1+=3Dsub(r2,r3)

Remove this - r1, r2, and r3 are uninitialized.=C2=A0 Then, you over= write r1 in the next packet.
=C2=A0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3D#0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1=3D#1
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0=3Dcmp.gt(r0,r1)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0=3Dcmp.gt(r0,r1)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0=3Dcmp.gt(r1,r0)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (!p0) jump:t pass
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }

diff --git a/tests/tcg/hexagon/test_call.S b/tests/= tcg/hexagon/test_call.S
new file mode 100644
index 0000000000..53a2450522
--- /dev/null
+++ b/tests/tcg/hexagon/test_call.S
@@ -0,0 +1,63 @@
+/* Purpose: test function calls and duplex instructions.
+ * The string "Hello there, I'm a test string!" with the fir= st letter replaced
+ * with a capital L should be printed out.
+ */
+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl=C2=A0 =C2=A0 test
+test:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jumpr r31
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memb(r0+#0)=3D#76
+=C2=A0 =C2=A0 }
+.Lfunc_end0:
+.Ltmp0:
+=C2=A0 =C2=A0 .size=C2=A0 =C2=A0 test, .Ltmp0-test
+
+=C2=A0 =C2=A0 .globl=C2=A0 =C2=A0 _start
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call test
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3D##dummy_buffer
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 allocframe(#0)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call write
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump pass
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r31:30=3Ddeallocframe(r30):raw
+=C2=A0 =C2=A0 }
+.Lfunc_end1:
+.Ltmp1:
+=C2=A0 =C2=A0 .size=C2=A0 =C2=A0 _start, .Ltmp1-_start
+write:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D##dummy_buffer
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 { r0=3Dr2; }

Assign to r= 0 directly
=C2=A0
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D#256
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 { r1=3Dr2; }

Assign to r= 1 directly

+=C2=A0 =C2=A0 { trap0(#7); }

This does= n't print anything - the syscall number goes in r6.=C2=A0 Is the intent= to invoke SYS_write?=C2=A0 If so, look at first.S to see how this is done.=

+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jumpr r31
+=C2=A0 =C2=A0 }
+.Lfunc_end2:
+.Ltmp2:
+=C2=A0 =C2=A0 .size=C2=A0 =C2=A0 write, .Ltmp2-write
+
+=C2=A0 =C2=A0 .type=C2=A0 =C2=A0 dummy_buffer,@object
+=C2=A0 =C2=A0 .data
+=C2=A0 =C2=A0 .globl=C2=A0 =C2=A0 dummy_buffer
+=C2=A0 =C2=A0 .p2align=C2=A0 =C2=A0 3
+dummy_buffer:
+=C2=A0 =C2=A0 .string=C2=A0 =C2=A0 "Hello there, I'm a test strin= g!\n"
+=C2=A0 =C2=A0 .space 223
+=C2=A0 =C2=A0 .size=C2=A0 =C2=A0 dummy_buffer, 256
= =C2=A0
=C2=A0
diff --git a/tests/tcg/hexagon/test_djump.S b/tests/tcg/hexagon/test_dj= ump.S
new file mode 100644
index 0000000000..dbad7eb0a1
--- /dev/null
+++ b/tests/tcg/hexagon/test_djump.S
@@ -0,0 +1,24 @@
+/* Purpose: show dual jumps actually work. This program features a packet = where
+ * two jumps should (in theory) be performed if !P0. However, we correctly=
+ * handle the situation by performing only the first one and ignoring the = second
+ * one. This can be verified by checking that the CPU dump contains 0xDEAD= BEEF
+ * in R2.
+ */

How does 0xDEADBEEF get into r2?

Do we need this test given that every other test re= lies on this idiom to check pass/fail?

+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1 =3D #255;
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D r1;
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (p0) jump:t pass
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
diff --git a/tests/tcg/hexagon/test_dotnew.S b/tests/tcg/hexagon/test_dotne= w.S
new file mode 100644
index 0000000000..3897c6bc96
--- /dev/null
+++ b/tests/tcg/hexagon/test_dotnew.S
@@ -0,0 +1,39 @@
+/* Purpose: test the .new operator while performing memory stores.
+ * In the final CPU dump R0 should contain 3, R1 should contain 2 and R2 s= hould
+ * contain 1.
+ */

CPU dump sounds like something you= have locally.=C2=A0 The check-tcg tests should not rely on this.

+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3D#1
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memw(sp+#0)=3Dr0.new
+=C2=A0 =C2=A0 }

You haven't set up= the stack, so you shouldn't use sp.=C2=A0 Even if the stack were set u= p, you should allocframe first.

+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1=3D#2
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memw(sp+#4)=3Dr1.new
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D#3
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memw(sp+#8)=3Dr2.new
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3Dmemw(sp+#8)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1=3Dmemw(sp+#4)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3Dmemw(sp+#0)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r3=3Dmpyi(r1,r2)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r3, #2); if (p0.new) jump:t pass=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
diff --git a/tests/tcg/hexagon/test_dstore.S b/tests/tcg/hexagon/test_dstor= e.S
new file mode 100644
index 0000000000..62c4301eb1
--- /dev/null
+++ b/tests/tcg/hexagon/test_dstore.S
@@ -0,0 +1,29 @@
+/* Purpose: test dual stores correctness.
+ * In this example the values 1 and 2 are both written on the top of the s= tack
+ * in a single packet.
+ * The value is then read back in R3, which should contain only the latest= value
+ * written (2).
+ */

=C2=A0This is already tested in du= al_stores.c

+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3D#1
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1=3D#2
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memw(sp+#0)=3Dr0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memw(sp+#0)=3Dr1
+=C2=A0 =C2=A0 }

Stack setup ...
<= div>
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r3=3Dmemw(sp+#0)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r3, #2); if (p0.new) jump:t pass=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
diff --git a/tests/tcg/hexagon/test_ext.S b/tests/tcg/hexagon/test_ext.S new file mode 100644
index 0000000000..0f6e21593a
--- /dev/null
+++ b/tests/tcg/hexagon/test_ext.S
@@ -0,0 +1,18 @@
+/* Purpose: test immediate extender instructions.
+ * In the CPU dump R0 should contain 0xDEADBEEF.

=
The CPU dump comment doesn't apply
=C2=A0
+ */
+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D##-559038737
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r2, ##-559038737); if (p0.new) j= ump:t pass
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
=C2=A0
+++ b/tests/tcg/hexagon/test_hello.S
@@ -0,0 +1,21 @@
+/* Purpose: simple hello world program. */

=
This is already tested in first.S

+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 { r0=3D#4; }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1=3D##.L.str
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 { trap0(#0); }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump pass
+=C2=A0 =C2=A0 }
+
+.L.str:
+=C2=A0 =C2=A0 .string=C2=A0 =C2=A0 "Hello world!\n"
+=C2=A0 =C2=A0 .size=C2=A0 =C2=A0 .L.str, 14
=C2=A0
diff --git a/tests/tcg= /hexagon/test_hwloops.S b/tests/tcg/hexagon/test_hwloops.S
new file mode 100644
index 0000000000..8337083d8e
--- /dev/null
+++ b/tests/tcg/hexagon/test_hwloops.S
@@ -0,0 +1,25 @@
+/* Purpose: simple C Program to test hardware loops.
+ * It should print numbersfrom 0 to 9.

This doesn't actually print anything.
=C2=A0
+ */
+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 loop0(.LBB0_1,#10)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D#0
+=C2=A0 =C2=A0 }
+.Ltmp0:
+.LBB0_1:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3Dadd(r2,#1)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 nop
+=C2=A0 =C2=A0 }:endloop0
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r2, #10); if (p0.new) jump:t pas= s
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
=C2=A0
diff --git a/tests/tcg/hexagon/test_jmp.S b/tests/tcg/hexagon/test_jmp.S new file mode 100644
index 0000000000..9bf6ea34e5
--- /dev/null
+++ b/tests/tcg/hexagon/test_jmp.S
@@ -0,0 +1,25 @@
+/* Purpose: test example, verify the soundness of the add operation */
=

What value does this test have beyond the = others in this set?

+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r1=3D#0
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D#0
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r3=3Dadd(r1,r2)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r3, #0)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (p0) jump:t pass
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }

diff = --git a/tests/tcg/hexagon/test_packet.S b/tests/tcg/hexagon/test_packet.S
new file mode 100644
index 0000000000..d26e284be9
--- /dev/null
+++ b/tests/tcg/hexagon/test_packet.S
@@ -0,0 +1,26 @@
+/* Purpose: test that writes of a register in a packet are performed only = after
+ * that packet has finished its execution.
+ */
+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r2=3D#4
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r3=3D#6
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 memw(sp+#0)=3Dr2

Stack problem

+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r3=3Dmemw(sp+#0)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 r0=3Dadd(r2,r3)
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r0, #10); if (p0.new) jump:t pas= s
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
diff --git a/tests/tcg/hexagon/test_reorder.S b/tests/tcg/hexagon/test_reor= der.S
new file mode 100644
index 0000000000..508d5302f9
--- /dev/null
+++ b/tests/tcg/hexagon/test_reorder.S
@@ -0,0 +1,31 @@
+/* Purpose: demonstrate handling of .new uses appearing before the associa= ted
+ * definition.
+ * Here we perform a jump that skips the code resetting R2 from 0xDEADBEEF= to 0,
+ * only if P0.new is true, but P0 is assigned to 1 (R4) in the next instru= ction
+ * in the packet.
+ * A successful run of the program will show R2 retaining the 0xDEADBEEF v= alue
+ * in the CPU dump.

CPU dump ...
=

+ */
+
+=C2=A0 =C2=A0 .text
+=C2=A0 =C2=A0 .globl _start
+
+_start:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 call init
+=C2=A0 =C2=A0 }
+=C2=A0 =C2=A0 { r2=3D#-559038737 }
+=C2=A0 =C2=A0 { r4=3D#1 }
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (p0.new) jump:nt skip
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0=3Dr4;
+=C2=A0 =C2=A0 }
+
+fallthrough:
+=C2=A0 =C2=A0 { r2=3D#0 }
+
+skip:
+=C2=A0 =C2=A0 {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 p0 =3D cmp.eq(r2, #-559038737); if (p0.new) ju= mp:t pass
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 jump fail
+=C2=A0 =C2=A0 }
=C2=A0
Each of these are ver= y small, so I recommend putting them into misc.c or combine all the assembl= y into a small number of executables.
--000000000000bdb6b405c59fe571--